diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 9d734db37..b522a09d6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -83,6 +83,10 @@ class IssuesController < ApplicationController :limit => @limit) @issue_count_by_group = @query.issue_count_by_group + + + + respond_to do |format| format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young format.api { diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index cdeb17e54..44496c3d7 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -34,6 +34,7 @@ class MessagesController < ApplicationController # Show a topic and its replies def show + @isReply = true page = params[:page] # Find the page of the requested reply if params[:r] && page.nil? @@ -103,6 +104,7 @@ class MessagesController < ApplicationController # Edit a message def edit + @isReply = false if @project (render_403; return false) unless @message.editable_by?(User.current) else @@ -123,7 +125,6 @@ class MessagesController < ApplicationController } end end - end # Delete a messages diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 91da700a1..14814ed32 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -37,14 +37,39 @@ class MyController < ApplicationController }.freeze def index + page render :action => 'page' - end + end # Show user's page def page @user = User.current + @Issues= Issue.visible.open. + where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) + @limit = 10 + @feedback_count = @Issues.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = @Issues[@offset, @limit] + + @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT + end + + def page2 + @limit = 10 + @user = User.current + @Issues= Issue.visible.open. + where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) + @feedback_count = @Issues.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = @Issues[@offset, @limit] + @state = false @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT + respond_to do |format| + format.js + end end # Edit user's account diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 9437889b2..e564bc940 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -148,7 +148,8 @@ class NewsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to news_path(@news) else - render :action => 'edit' + #flash[:error] = l(:notice_successful_update) + redirect_to news_path(@news) end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1893224f8..ee42c2c6a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -407,7 +407,7 @@ class ProjectsController < ApplicationController @page = @page.to_i # Find the page of the requested reply @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 3 + @limit = 10 offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) page = 1 + offset / @limit diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index e31bb2738..2d03b2112 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -99,7 +99,7 @@ class WordsController < ApplicationController @project = Project.find params[:project_id] # Find the page of the requested reply @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 3 + @limit = 10 offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) page = 1 + offset / @limit diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index aad350d22..e08e50e80 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -441,7 +441,7 @@ module CoursesHelper def homework_user_of_homework homework,is_teacher homework_users = "" homework.users.each do |user| - homework_users = homework_users + (is_teacher ? user.realname : user.name) + homework_users = homework_users + (is_teacher ? (user.firstname + user.lastname) : user.login) if user != homework.users.last homework_users = homework_users + "、" end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 0677d324b..e5fbd3f82 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,7 @@ - + <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> + <% if isReply %> + <% container.saved_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;") + @@ -10,6 +11,18 @@ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <% end %> + <% else %> + <% 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') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% end %> <% end %> + <%= label_tips %> @@ -15,8 +68,9 @@