From 03850139051be65f1a7a4d0f4167e8c868820c18 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 15 May 2014 19:16:36 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=20=E5=8E=BB=E9=99=A4=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=E5=9E=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 16 ++++++++++++---- app/controllers/bids_controller.rb | 12 ++++++++---- app/helpers/bids_helper.rb | 4 ++++ app/views/bids/_list_projects.html.erb | 4 ++-- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index cf39898fe..af8487868 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -276,10 +276,18 @@ class AccountController < ApplicationController set_autologin_cookie(user) end call_hook(:controller_account_success_authentication_after, {:user => user }) - #by young -# redirect_back_or_default my_page_path - redirect_back_or_default User.current -# redirect_to User.current + + code = /\d*/ + #根据home_url生产正则表达式 + eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") + if code=~params[:back_url] + redirect_to user_activities_path(user) + else + #by young + #redirect_back_or_default my_page_path + redirect_back_or_default User.current + #redirect_to User.current + end end def set_autologin_cookie(user) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 206421e5d..1ae04fa08 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -18,6 +18,8 @@ class BidsController < ApplicationController helper :attachments include AttachmentsHelper include ApplicationHelper + include BidsHelper + helper :projects helper :words helper :welcome @@ -503,10 +505,12 @@ class BidsController < ApplicationController #删除已提交的项目作业(不删项目) def delete binding_project = params[:binding_project] - if BidingProject.delete(binding_project) - redirect_to project_for_bid_path - else - redirect_to 403; + if can_delete_project_homework(BidingProject.find(binding_project),User.current) + if BidingProject.delete(binding_project) + redirect_to project_for_bid_path + else + redirect_to 403; + end end end ## 新建留言 diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index bd39d6c28..38b32e692 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -151,4 +151,8 @@ module BidsHelper tmp end + def can_delete_project_homework bind_project,current_user + current_user.id == bind_project.user.id || current_user.admin + end + end \ No newline at end of file diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index e51314c48..ce24a4457 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -154,9 +154,9 @@ <% end %> - <% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id + <% if can_delete_project_homework b_project,User.current %> - <%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %> + <%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => l(:text_are_you_sure) %> <% end %> From 029eb1a19538484944abdde5b493d36f43b8f95b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 16 May 2014 11:02:25 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 27 ++++ app/models/homework_attach.rb | 4 +- app/models/journals_for_message.rb | 1 + app/views/attachments/_app_link.html.erb | 9 +- app/views/bids/_homework_list.html.erb | 15 +- app/views/bids/show_project.html.erb | 7 +- app/views/homework_attach/show.html.erb | 148 ++++++++++++++++++ app/views/softapplications/_new_message.erb | 10 +- config/routes.rb | 2 +- 9 files changed, 208 insertions(+), 15 deletions(-) create mode 100644 app/controllers/homework_attach_controller.rb create mode 100644 app/views/homework_attach/show.html.erb diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb new file mode 100644 index 000000000..cfa84071b --- /dev/null +++ b/app/controllers/homework_attach_controller.rb @@ -0,0 +1,27 @@ +class HomeworkAttachController < ApplicationController + #显示作业信息 + def show + @homework = HomeworkAttach.find(params[:id]) + # 打分统计 + stars_reates = @homework. + rates(:quality) + stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count + stars_status = stars_reates.select("stars, count(*) as scount"). + group("stars") + @stars_status_map = Hash.new(0.0) + stars_status.each do |star_status| + percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f + percent_m = format("%.2f", percent) + @stars_status_map["star#{star_status.stars.to_i}".to_sym] = + percent_m.to_s + "%" + end + @jours = @homework.journals_for_messages.order("created_on DESC") + end + + def destroyjours + @homework = HomeworkAttach.find(params[:homework_id]) + JournalsForMessage.delete_message(params[:object_id]) + redirect_to homework_attach_path(@homework) + end +end + diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index fb743ab5c..b8e559dff 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -2,9 +2,11 @@ class HomeworkAttach < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :user belongs_to :bid + has_many :journals_for_messages, :as => :jour, :dependent => :destroy + seems_rateable :allow_update => true, :dimensions => :quality safe_attributes "bid_id", "user_id" acts_as_attachable - + end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2c4f10886..575737401 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -21,6 +21,7 @@ class JournalsForMessage < ActiveRecord::Base belongs_to :jour, :polymorphic => true belongs_to :user + belongs_to :homework_attach belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id' acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"}, diff --git a/app/views/attachments/_app_link.html.erb b/app/views/attachments/_app_link.html.erb index ecef4dda3..6934b76e1 100644 --- a/app/views/attachments/_app_link.html.erb +++ b/app/views/attachments/_app_link.html.erb @@ -1,10 +1,15 @@ -<% for attachment in attachments %><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> - <% if attachment.is_text? %> +<% for attachment in attachments %> + <% if attachments.count > 1 && attachment != attachments.first%> +
                 + <% end %> + <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), :controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename %> <% end %> <%= h(" - #{attachment.description}") unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) + <% end -%> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 8f87a6b37..f3658cd2a 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -25,8 +25,19 @@ <%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> +    作业   :  + <% filename = "" %> + <% homework.attachments.map do |attachment| %> + <% filename = attachment.filename %> + <% if homework.attachments.count > 1%> + <% filename += "等#{homework.attachments.count}个文件" %> + <% end %> + <% break %> + <% end %> + <%= link_to filename , homework_attach_path(homework)%> + - + diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index d22ddded6..02ef72e7c 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -60,7 +60,6 @@ $("#put-bid-form").hide(); } - <% if User.current.logged? %> @@ -89,15 +88,15 @@ - <% end %> + <% end %>
<%= link_to homework.user, user_path(homework.user)%> 已提交  发布人:  <%= link_to homework.user, user_path(homework.user)%> <% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %> 迟交 @@ -36,7 +47,7 @@
  <% if display_id %> - <%= l(:label_bidding_user_studentcode) %> :<%= homework.user.user_extensions.student_id%> + <%= l(:label_bidding_user_studentcode) %>  : <%= homework.user.user_extensions.student_id%> <% end %>
<%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%>
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'"%> - <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", + <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -30px'" %> + :onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb new file mode 100644 index 000000000..93e3d0a70 --- /dev/null +++ b/app/views/homework_attach/show.html.erb @@ -0,0 +1,148 @@ +<%= render_flash_messages %> + +

<%= notice %>

+ +
+ + + + + + + + + + + + + + + + + + + + + +
作业基础信息<%=@count %>
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>发布时间:<%=format_time @homework.created_at %>
+ 作业下载: + <% options = {:author => true } %> + <%= render :partial => 'attachments/app_link', :locals => {:attachments => @homework.attachments, :options => options} %> + 所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
平均评分: + <%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %> +
+ + +
+
+ +
+ + + + + + + + + <% @homework.attachments.map do |attachment| %> + <% if attachment.description != nil && attachment.description != "" %> + + + + <% end %> + <% end %> +
作业描述:
+
<%= attachment.description %>
+
+ + +
+
+ +
+
作业得分:
+
+
+
得分比例
+
+ <% 100.step(20,-20) do |star| %> +
+
+
+
+
+
+ <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %> +
+ <% end %> +
+
+
+
最终得分
+
+ <%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %> +
+
+
+
打分总人数
+
+ + <%= @homework.raters(:quality).count%> + +
+
+
+
+
+ +
+
作业评论:
+
评分: + <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %> + (您可以重新打分,打分结果以最后一次打分为主!) +
+ +
+ + +
+ <% if User.current.logged? %> + <% else %> + <% end %> +
+ + + +
+<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %> +
diff --git a/app/views/softapplications/_new_message.erb b/app/views/softapplications/_new_message.erb index 321c7911f..ff63a3675 100644 --- a/app/views/softapplications/_new_message.erb +++ b/app/views/softapplications/_new_message.erb @@ -15,7 +15,7 @@ } -<%= form_for('softapplication_message', +<%= form_for('softapplication_message', :remote => true, :method => :post, :url => {:controller => 'softapplications', :action => 'create_message', @@ -23,19 +23,19 @@ :sta => sta} ) do |f|%> -
+
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
- + <% if User.current.logged? %>
<%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%>
- + <%= f.text_field :reference_user_id, :style=>"display:none"%> - + diff --git a/config/routes.rb b/config/routes.rb index a5dc322cf..f0bdfede8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,7 +22,7 @@ RedmineApp::Application.routes.draw do resources :apply_project_masters delete 'apply_project_masters', :to => 'apply_project_masters#delete' - + resources :homework_attach resources :open_source_projects do collection do match 'search', via: [:get, :post] From 5d153494823085b76df4ef3e84907c21c7e83f64 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 16 May 2014 17:45:20 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=E5=B7=B2=E6=B7=BB=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form.html.erb | 10 +++++----- app/views/bids/_homework_form.html.erb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index f34a0e4e7..f05c4e9b0 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,10 +1,10 @@ <% if defined?(container) && container && container.saved_attachments %> - <% container.saved_attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename', :maxlength => 10)%> - - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 155, :placeholder => l(:label_optional_description), :class => 'description') + + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index fe6f35fb3..6d9230a91 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -37,5 +37,5 @@

<%= hidden_field_tag 'course_id', @project_id %>

<%= l(:label_attachment_plural) %> -

<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>

+

<%= render :partial => 'attachments/form', :locals => {:container => @bid} %>

\ No newline at end of file From 63af60d7b676ae28ce16254bc880246e10d8d5fa Mon Sep 17 00:00:00 2001 From: yanxd Date: Sat, 17 May 2014 10:44:01 +0800 Subject: [PATCH 4/6] =?UTF-8?q?edit=20=E5=9B=BE=E6=A0=87=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=20bid=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 4 ++-- public/images/edit.png | Bin 0 -> 522 bytes 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 public/images/edit.png diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 1ae04fa08..2273de4e4 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -732,9 +732,9 @@ class BidsController < ApplicationController def update @bid = Bid.find(params[:id]) @project = @bid.courses.first#Project.find(params[:course_id]) - if @bid.update_attributes(params[:bid]) + @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) + if @bid.update_attributes(params[:bid]) && @bid.save flash[:notice] = l(:label_update_homework_succeed) - #@project = Project.find(params[:course_id]) redirect_to project_homework_path(@project) else @bid.safe_attributes = params[:bid] diff --git a/public/images/edit.png b/public/images/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..8335716fd5f9994eca802b8b14fb43c667bcc034 GIT binary patch literal 522 zcmV+l0`>igP)Pft(g&!0d4|DQhl|Nrg@{~ubrZp3Q+~ymoxxm8*H4N^pv1Yip)*8iT zxaN1O|Nnnp_5bP)+t({+c&Ek2#xlS#b^{t;j635SH*4VjT z*<#CZXO|5F$dCp79t`2(;b06m;ObIawo8j`bN;_O^Zx&%B%tP+|GVZnojSDGvFh|1 zI|h&eGrK(D8Zitwy}-`$|HbSB|394j|NrT#ubU=2AKo#?$-T4Mhhb8qH-<(G1NP2z zY6WXP6?Ab`x9hCl3ZDR=0#P6q#-$m>03hf8sxH@A9c8}B$+01(K)x;zYXPwd5c2~u zFA#G9F$WN{0Wk{@GZRe8Kt+l`EDOYvKr8~p0zk|SGl-(B3^afV01ba!p4w(>hyVZp M07*qoM6N<$f^G@~i~s-t literal 0 HcmV?d00001 From f79679f05a09ff694eb09cf68727d928544d631d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 17 May 2014 11:15:27 +0800 Subject: [PATCH 5/6] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C=202.?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BD=9C=E4=B8=9A=E4=BA=92=E8=AF=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=203.=E5=A2=9E=E5=8A=A0=E4=BD=9C=E4=B8=9A=E7=95=99?= =?UTF-8?q?=E8=A8=80=E3=80=81=E7=95=99=E8=A8=80=E5=88=A0=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=90=8E=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 28 +++++- app/models/homework_attach.rb | 5 + app/views/homework_attach/_addjour.html.erb | 93 +++++++++++++++++++ app/views/homework_attach/_pre_show.html.erb | 11 +++ app/views/homework_attach/_showjour.html.erb | 64 +++++++++++++ app/views/homework_attach/addjours.js.erb | 4 + app/views/homework_attach/destroy.js.erb | 11 +++ app/views/homework_attach/show.html.erb | 35 ++----- app/views/words/_message.html.erb | 2 +- config/routes.rb | 1 + 10 files changed, 220 insertions(+), 34 deletions(-) create mode 100644 app/views/homework_attach/_addjour.html.erb create mode 100644 app/views/homework_attach/_pre_show.html.erb create mode 100644 app/views/homework_attach/_showjour.html.erb create mode 100644 app/views/homework_attach/addjours.js.erb create mode 100644 app/views/homework_attach/destroy.js.erb diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index cfa84071b..cf0276d97 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -16,12 +16,32 @@ class HomeworkAttachController < ApplicationController percent_m.to_s + "%" end @jours = @homework.journals_for_messages.order("created_on DESC") + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] end - def destroyjours - @homework = HomeworkAttach.find(params[:homework_id]) - JournalsForMessage.delete_message(params[:object_id]) - redirect_to homework_attach_path(@homework) + def destroy + @journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) + respond_to do |format| + format.js + end + end + + def addjours + @homework = HomeworkAttach.find(params[:jour_id]) + @homework.addjours User.current.id, params[:new_form][:user_message],0 + @jours = @homework.journals_for_messages.order("created_on DESC") + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + respond_to do |format| + format.js + end end end diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index b8e559dff..2e5ade8b3 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -9,4 +9,9 @@ class HomeworkAttach < ActiveRecord::Base "user_id" acts_as_attachable + def addjours user_id,message,status = 0 + jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status) + jfm.save + jfm + end end diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb new file mode 100644 index 000000000..a5e7bed66 --- /dev/null +++ b/app/views/homework_attach/_addjour.html.erb @@ -0,0 +1,93 @@ + + + + + +<%= form_for('new_form', :remote => true, :method => :post, + :url => {:controller => 'homework_attach', + :action => 'addjours', + :jour_id => homework_attach.id, + :sta => sta}) do |f|%> + +
+ <%= render :partial => 'words/pre_show', :locals => {:content => @content} %> +
+ + <% if User.current.logged? %> +
+ + + +
<%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}", + :onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')", + :onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')", + :style => "resize: none;", :class => 'noline'%>
+ <%= f.text_field :reference_user_id, :style=>"display:none"%> + + + + +
<%= submit_tag l(:button_leave_meassge), + :name => nil , :class => "enterprise", + :onmouseout => "this.style.backgroundPosition = 'left top'", + :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> + <%= submit_tag l(:button_clear), :name => nil, :class => "enterprise", + :onclick => "clearMessage('new_form_user_message');", + :onmouseout => "this.style.backgroundPosition = 'left top'", + :onmouseover => "this.style.backgroundPosition = 'left -31px'" %>
+ <% else %> +
+ <%= l(:label_user_login_tips) %> + <%= link_to l(:label_user_login_new), signin_path %> +
+ <% end %> +<% end %> diff --git a/app/views/homework_attach/_pre_show.html.erb b/app/views/homework_attach/_pre_show.html.erb new file mode 100644 index 000000000..1fb643183 --- /dev/null +++ b/app/views/homework_attach/_pre_show.html.erb @@ -0,0 +1,11 @@ + +<% unless content.nil?%> + + + + + + + +
<%= textilizable content %>
<%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%>
+<% end %> diff --git a/app/views/homework_attach/_showjour.html.erb b/app/views/homework_attach/_showjour.html.erb new file mode 100644 index 000000000..f810082c9 --- /dev/null +++ b/app/views/homework_attach/_showjour.html.erb @@ -0,0 +1,64 @@ + +<% if jour.size > 0 %> + +<% end %> \ No newline at end of file diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb new file mode 100644 index 000000000..e463237e5 --- /dev/null +++ b/app/views/homework_attach/addjours.js.erb @@ -0,0 +1,4 @@ +$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>'); +$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); +$('#new_form_user_message').val(""); +$('#new_form_reference_user_id').val(""); \ No newline at end of file diff --git a/app/views/homework_attach/destroy.js.erb b/app/views/homework_attach/destroy.js.erb new file mode 100644 index 000000000..f3d9a7bef --- /dev/null +++ b/app/views/homework_attach/destroy.js.erb @@ -0,0 +1,11 @@ +<% if @journal_destroyed.nil? %> + alert('<%=l(:notice_failed_delete)%>'); +<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%> + var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); +<% else %> + $('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jour, :state => false})) %>'); + $('#new_form_reference_user_id').val(""); +<% end %> diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb index 93e3d0a70..1400176c2 100644 --- a/app/views/homework_attach/show.html.erb +++ b/app/views/homework_attach/show.html.erb @@ -1,4 +1,4 @@ -<%= render_flash_messages %> +