From 08f625446e478d635109def1232a790c60319ac1 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 10 Mar 2015 10:18:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?app=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=96=B0=E5=BB=BA=E7=89=88=E6=9C=AC=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/mobile_version.html.erb | 14 +++++++++++--- config/locales/zh.yml | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/views/admin/mobile_version.html.erb b/app/views/admin/mobile_version.html.erb index 293b0ec46..5ea340245 100644 --- a/app/views/admin/mobile_version.html.erb +++ b/app/views/admin/mobile_version.html.erb @@ -1,9 +1,17 @@

<%= l(:label_mobile_version) %>

发布新版本
- + <%= form_tag(:controller => 'admin', :action => 'create_version') do %> +

+ + <%= text_field_tag 'version', params[:version],:value => @new_version.version, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

+

+ + <%= text_field_tag 'description', params[:description],:value => @new_version.description,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

+ <%= submit_tag l(:button_save), :class => "small", :name => nil %> + <% end %>

当前版本:
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ac975f67f..e2b5ea53a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -559,8 +559,8 @@ zh: label_organizer_name: 主办单位名称 label_web_footer_description: 页脚内容 label_cooperation_compnay: 合作单位 - label_version_number: 版本号 - label_version_description: 版本描述 + label_version_number: 版本 + label_version_description: 描述 label_web_footer_cooperation_compnay: 网站页脚合作单位 label_new_company: 添加合作单位 label_edit_company: 编辑合作单位 From 57c97f3dc8c37d62c47e7d0b49edb724f82575c0 Mon Sep 17 00:00:00 2001 From: whimlex Date: Tue, 10 Mar 2015 11:12:38 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=B1=82=E7=BA=A7=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=A0=87=E7=AD=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_jour.html.erb | 2 +- app/views/homework_attach/_journal_reply_items.html.erb | 2 +- app/views/homework_attach/_showjour.html.erb | 2 +- app/views/words/_feedback.html.erb | 2 +- app/views/words/_journal_reply_items.html.erb | 2 +- app/views/words/_message.html.erb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index cae04b0c0..45c5a1318 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -25,7 +25,7 @@ :homework_id =>homework.id }, :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> <% end %> - <%= link_to l(:label_newfeedback_respone),'', + <%= link_to l(:label_newfeedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} %> diff --git a/app/views/homework_attach/_journal_reply_items.html.erb b/app/views/homework_attach/_journal_reply_items.html.erb index 2c7ac886c..06fea3946 100644 --- a/app/views/homework_attach/_journal_reply_items.html.erb +++ b/app/views/homework_attach/_journal_reply_items.html.erb @@ -34,7 +34,7 @@ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> <% end %> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respone),'', + <%= link_to l(:label_newfeedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> <% end %> diff --git a/app/views/homework_attach/_showjour.html.erb b/app/views/homework_attach/_showjour.html.erb index 018d16141..c9f390fd1 100644 --- a/app/views/homework_attach/_showjour.html.erb +++ b/app/views/homework_attach/_showjour.html.erb @@ -65,7 +65,7 @@ <% ids = 'project_respond_form_'+ journal.id.to_s%> - <%= link_to l(:label_newfeedback_respone),'', + <%= link_to l(:label_newfeedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %> <% if journal.user==User.current|| User.current.admin? %> diff --git a/app/views/words/_feedback.html.erb b/app/views/words/_feedback.html.erb index 493378279..7bbf76d49 100644 --- a/app/views/words/_feedback.html.erb +++ b/app/views/words/_feedback.html.erb @@ -11,7 +11,7 @@ <% id = 'project_respond_form_'+journal.id.to_s%> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respone),'#', + <%= link_to l(:label_newfeedback_respond),'#', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 9076006cc..7b4658a56 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -36,7 +36,7 @@ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> <% end %> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respone),'', + <%= link_to l(:label_newfeedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> <% end %> diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index 163f13523..8182beaaa 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -51,7 +51,7 @@ function checkMaxLength() { <% ids = 'project_respond_form_'+ journal.id.to_s%> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respone),'', + <%= link_to l(:label_newfeedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %> <% end %> From 803f4a3eaf91851afbaec09cbe849a6ca940e0bd Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 10 Mar 2015 14:41:36 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1=E3=80=81=E9=83=A8=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B9=E6=8D=AEapptoken=E5=8F=82=E6=95=B0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=99=BB=E5=BD=95=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?token=E6=98=AF=E5=90=A6=E8=BF=87=E6=9C=9F=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E3=80=822=E3=80=81=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=96=B0=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 23 ++++++++++++++++++++++- app/controllers/application_controller.rb | 3 +++ app/models/phone_app_version.rb | 2 ++ app/views/admin/mobile_version.html.erb | 2 +- config/locales/zh.yml | 1 + 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index c77ebe704..413ed9692 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -337,7 +337,28 @@ class AdminController < ApplicationController end def create_version - + @versions = PhoneAppVersion.reorder('created_at desc') + @new_version = PhoneAppVersion.new + @new_version.version = params[:version] + @new_version.description = params[:description] + if @new_version.save + respond_to do |format| + format.html { + flash[:notice] = l(:notice_successful_create) + redirect_to mobile_version_url + } + format.api { render_api_ok } + end + else + respond_to do |format| + flash.now[:error] = "#{l :label_version_create_fail}: #{@new_version.errors.full_messages[0]}" + #flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}" + format.html { + render :action => 'mobile_version' + } + format.api { render_validation_errors(@new_version) } + end + end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c26ec07e..47251cf85 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -181,6 +181,9 @@ class ApplicationController < ActionController::Base #从手机端传来apptoken则将当前登陆用户变为对应的用户 if params[:apptoken] token = ApiKey.where(access_token: params[:apptoken]).first + if token.expired? + return + end if token && !token.expired? @current_user = User.find(token.user_id) end diff --git a/app/models/phone_app_version.rb b/app/models/phone_app_version.rb index abf4c54e3..4dc1503c9 100644 --- a/app/models/phone_app_version.rb +++ b/app/models/phone_app_version.rb @@ -1,3 +1,5 @@ class PhoneAppVersion < ActiveRecord::Base attr_accessible :description, :version + validates_presence_of :description, :version + validates_uniqueness_of :version end diff --git a/app/views/admin/mobile_version.html.erb b/app/views/admin/mobile_version.html.erb index 5ea340245..0d38b449a 100644 --- a/app/views/admin/mobile_version.html.erb +++ b/app/views/admin/mobile_version.html.erb @@ -1,7 +1,7 @@

<%= l(:label_mobile_version) %>

发布新版本
- <%= form_tag(:controller => 'admin', :action => 'create_version') do %> + <%= form_tag({:controller => 'admin', :action => 'create_version'},{:id => 'new_version',:style=>'display:none'}) do %>

<%= text_field_tag 'version', params[:version],:value => @new_version.version, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e2b5ea53a..26dc11508 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1979,6 +1979,7 @@ zh: label_forum_update_succ: 贴吧更新成功 label_forum_update_fail: 贴吧更新失败 label_first_page_create_fail: 首页定制失败 + label_version_create_fail: 版本发布失败 label_forum_edit: 编辑讨论区 label_memo_create: 发布 label_memo_new: 新建帖子 From 383d90bb12f566855535dd82a4827f529f8e8515 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 10 Mar 2015 16:26:22 +0800 Subject: [PATCH 4/5] =?UTF-8?q?issue2626=EF=BC=8C=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E6=97=B6=E5=80=99=E5=88=9B=E5=BB=BA=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E4=BF=A1=E6=81=AF=E4=B9=9F=E8=A6=81=E5=8A=A0?= =?UTF-8?q?=E8=BF=9B=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index fc64d3af8..0081fde84 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -21,7 +21,37 @@

<% unless @events_pages.empty? %> <% @events_pages.each do |e| -%> - <% act = e.forge_act; + <% if e.forge_act_type == "ProjectCreateInfo"%> +
+ + + + + +
+ <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> + + + + + + +
+ + <%= link_to_user(e.user)%> + + <%= l(:label_project_new) %> + <%= link_to e.project.name %> + ! +
+ <%= l :label_create_time %>: + <%= format_time(e.created_at) %> +
+
+
+ <% end %> + <% next if e.forge_act_type.safe_constantize.nil? + act = e.forge_act; next if act.nil? %> <% if e.forge_act_type == "Issue" %>
From 87394fe4cefd42efa08e7264ba714b7df60954a2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 10 Mar 2015 16:27:32 +0800 Subject: [PATCH 5/5] =?UTF-8?q?issue2626=EF=BC=8C=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E6=97=B6=E5=80=99=E5=88=9B=E5=BB=BA=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E4=BF=A1=E6=81=AF=E4=B9=9F=E8=A6=81=E5=8A=A0?= =?UTF-8?q?=E8=BF=9B=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 099870bc7..313652bf4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -131,7 +131,7 @@ class Project < ActiveRecord::Base #ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用 after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} # 创建project之后默认创建一个board,之后的board去掉了board的概念 - after_create :create_board_sync + after_create :create_board_sync,:acts_as_forge_activities before_destroy :delete_all_members def remove_references_before_destroy return if self.id.nil? @@ -1154,6 +1154,13 @@ class Project < ActiveRecord::Base end end - + # Time 2015-03-10 15:33:16 + # Author lizanle + # Description 新建项目要在ForgeActivities中加一条数据。 + def acts_as_forge_activities + fa = ForgeActivity.new(:user_id => User.current.id,:project_id => self.id, + :forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo") + fa.save! + end end