diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index aad575ee5..9f261c78a 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -89,10 +89,9 @@ class MemosController < ApplicationController offset(@reply_pages.offset). all if @memo.new_record? - format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } + format.html { render :new,:layout=>'base'} else - format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } - # format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } + format.html { render action: :show } format.json { render json: @memo.errors, status: :unprocessable_entity } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f976918d8..cdb71170d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -127,7 +127,7 @@ module ApplicationHelper # * :text - Link text (default to attachment filename) # * :download - Force download (default: false) def link_to_short_attachment(attachment, options={}) - text = h(truncate(options.delete(:text) || attachment.filename, length: 25, omission: '...')) + text = h(truncate(options.delete(:text) || attachment.filename, length: 23, omission: '...')) route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path html_options = options.slice!(:only_path) url = send(route_method, attachment, attachment.filename, options) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index de43dce4c..698198120 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -12,7 +12,7 @@ :filename => attachment.filename%> <% end %> - <%= h(truncate(" - #{attachment.description}", length: 20, omission: '...')) unless attachment.description.blank? %> + <%= h(truncate(" - #{attachment.description}", length: 15, omission: '...')) unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) <% if options[:deletable] %> @@ -34,7 +34,10 @@ <% end %> <% if options[:author] %> - <%= link_to h(attachment.author),user_path(attachment.author) %>, <%= format_time(attachment.created_on) %> + + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>, + <%= format_time(attachment.created_on) %> + <% end %>

<% end %> diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index 63c196cef..5ba7b9e34 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -22,60 +22,21 @@ } } - - - <% object = [] %> <% object << 'course' %> <%= error_messages_for object %> - - - <% unless @course.new_record? %>

<%= render :partial => "avatar/avatar_form", :locals => {source: @course} %>

<% end %> - -

+

+ +

- - - - <%= f.fields_for @course do |m| %> - - - - - <% unless @course.nil? %>

@@ -98,12 +59,9 @@ <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时", :maxlength => 5 %><%= l(:label_class_hour) %> -

+ +

<% end %> - - - -

@@ -127,16 +85,6 @@

- - - - - - - - - -

<%= l(:text_command) %> <% end %> - -

- -

<%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %>

<%= f.text_field :course_type, :value => 1 %>

- - <%= wikitoolbar_for 'course_description' %> - <% @course.custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :course, value %>

<% end %> <%= call_hook(:view_courses_form, :course => @course, :form => f) %> - - - <% unless @course.extra_frozen? %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index ff0a3e6e1..a1feaf12a 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,8 +1,6 @@ <% if @events_by_day != nil && @events_by_day.size >0 %>
-

- <%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

<% @events_by_day.keys.sort.reverse.each do |day| %> @@ -13,23 +11,21 @@ <%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %> - +
- @@ -53,7 +49,6 @@
+ <%= h(e.event_title) if @course.nil? || (e.course != nil && @course.id != e.course.id) %> - - <% if @canShowRealName %> - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> - (<%= link_to_user(e.event_author, @canShowRealName) if e.respond_to?(:event_author) %> - ) - <% else %> - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> - <% end %> - - <%= l(:label_new_activity) %> - - - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:style => "word-break:break-all;word-wrap: break-word;" %> + + <% if @canShowRealName %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> + (<%= link_to_user(e.event_author, @canShowRealName) if e.respond_to?(:event_author) %> + ) + <% else %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> + <% end %> + <%= l(:label_new_activity) %> + + <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url%>
- <% end %> diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb index fdce1cc83..14944792d 100644 --- a/app/views/layouts/base_memos.html.erb +++ b/app/views/layouts/base_memos.html.erb @@ -56,7 +56,7 @@ -<%= link_to l(:button_back), forum_path(@forum) %> + diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index f57bc97d7..51f082ae6 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -39,30 +39,31 @@
- <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> + <% else %> + <% if @school_id == "0" %> <% else %> - <% if @school_id == "0" %> - <% else %> - <% if @school_id.nil? %> - <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> -
- <% else %> - <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> -
- <% end %> - <% end %> - <% end %>
+ <% if @school_id.nil? %> + <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> +
+ <% else %> + <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> +
+ <% end %> + <% end %> + <% end %> +
<% unless @course_page.nil? %> - <%= @course_page.title %> + <%= @course_page.title %> - <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> - , <%= @course_page.description %> - <% else %> - <% if @school_id == "0" %> + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> , <%= @course_page.description %> + <% else %> + <% if @school_id == "0" %> + , <%= @course_page.description %> + <% end %> <% end %> <% end %> - <% end %>
<% else %> - <% if school_course.count < 10 %> + <% if school_course.count < 9 %> <%= render :partial => 'more_course', :locals => {:school_id => nil}%> @@ -110,7 +111,7 @@
diff --git a/db/migrate/20140922032830_change225_bid_data.rb b/db/migrate/20140922032830_change225_bid_data.rb new file mode 100644 index 000000000..f41ec73c0 --- /dev/null +++ b/db/migrate/20140922032830_change225_bid_data.rb @@ -0,0 +1,13 @@ +class Change225BidData < ActiveRecord::Migration + def up + bid = Bid.find 225 + bid.proportion = 60 + bid.save + end + + def down + bid = Bid.find 225 + bid.proportion = 60 + bid.save + end +end diff --git a/db/schema.rb b/db/schema.rb index ebf24f547..817104aa9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140916005319) do +ActiveRecord::Schema.define(:version => 20140922032830) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false