Mercurial > hg > soundsoftware-site
changeset 776:af852d82b00b feature_14
Addresses Bug #321. New Projects Controller action to save the fieldsets status as session variables.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 17 Nov 2011 18:24:01 +0000 |
parents | a7cb76a52ec0 |
children | facded821cee |
files | vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml vendor/plugins/redmine_tags/app/views/projects/index.rhtml vendor/plugins/redmine_tags/assets/javascripts/projects_index.js vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb |
diffstat | 5 files changed, 63 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml Thu Nov 17 14:52:13 2011 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml Thu Nov 17 18:24:01 2011 +0000 @@ -1,5 +1,11 @@ -<fieldset id="filters" class="collapsible"> - <legend onclick="toggleFieldset(this);"><%= l(:label_my_projects) %></legend> +<% if @myproj_status %> +<fieldset id="my_projects_fieldset" class="collapsible"> + <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_my_projects) %></legend> +<% else %> +<fieldset id="my_projects_fieldset" class="collapsible collapsed"> + <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_my_projects) %></legend> + <div style="display: none;"> +<% end%> <% if @user_projects %> <div> <%= render_my_project_hierarchy(@user_projects)%>
--- a/vendor/plugins/redmine_tags/app/views/projects/index.rhtml Thu Nov 17 14:52:13 2011 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/index.rhtml Thu Nov 17 18:24:01 2011 +0000 @@ -16,12 +16,18 @@ <%= render :partial => 'my_projects' %> <% end %> - <div style="clear:both;"></div> <% form_tag(:controller => :projects, :action => :index, :method => :get, :id => :project_filtering) do %> - <fieldset id="filters" class="collapsible collapsed"> - <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> - <div style="display: none;"> + + +<% if @filter_status %> +<fieldset id="filters_fieldset" class="collapsible"> + <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> +<% else %> + <fieldset id="filters_fieldset" class="collapsible collapsed"> + <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> + <div style="display: none;"> +<% end %> <div> <p class='q'> <%= label_tag 'q', l('project_filtering_q_label') %>
--- a/vendor/plugins/redmine_tags/assets/javascripts/projects_index.js Thu Nov 17 14:52:13 2011 +0000 +++ b/vendor/plugins/redmine_tags/assets/javascripts/projects_index.js Thu Nov 17 18:24:01 2011 +0000 @@ -1,3 +1,24 @@ Event.observe(window, 'load', function() { -}); \ No newline at end of file +}); + + +function toggleFieldsetWithState(this_field){ + toggleFieldset(this_field); + + id = Element.up(this_field, 'fieldset').id; + + // is the fieldset collapsed? + status = $(id).hasClassName("collapsed"); + + change_session(id, status); +}; + +function change_session(id, nstatus) { + var url = "projects/set_fieldset_status"; + var request = new Ajax.Request(url, { + method: 'post', + parameters: {field_id: id, status: nstatus}, + asynchronous: true + }); +} \ No newline at end of file
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Thu Nov 17 14:52:13 2011 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Thu Nov 17 18:24:01 2011 +0000 @@ -7,6 +7,8 @@ base.send(:include, InstanceMethods) base.class_eval do unloadable + skip_before_filter :authorize, :only => [:set_fieldset_status] + skip_before_filter :find_project, :only => [:set_fieldset_status] before_filter :add_tags_to_project, :only => [:save, :update] # before_filter :filter_projects, :only => :index @@ -30,7 +32,6 @@ end end - def paginate_projects sort_init 'name' sort_update %w(name lft created_on updated_on) @@ -40,22 +41,28 @@ @offset ||= @project_pages.current.offset end - def set_fieldset_status(field, status) + def set_fieldset_status + + # luisf. test for missing parameters……… + field = params[:field_id] + status = params[:status] + session[(field + "_status").to_sym] = status + render :nothing => true end # gets the status of the collabsible fieldsets - def get_fieldset_statuses - if session[:filter_status].nil? - @filter_status = session[:filter_status] + def get_fieldset_statuses + if session[:my_projects_fieldset_status].nil? + @myproj_status = true else + @myproj_status = session[:my_projects_fieldset_status] + end + + if session[:filters_fieldset_status].nil? @filter_status = false - end - - if session[:myproj_status].nil? - @myproj_status = session[:myproj_status] else - @myproj_status = true + @filter_status = session[:filters_fieldset_status] end end @@ -64,6 +71,11 @@ def filtered_index @project = Project.new filter_projects + + debugger + + logger.error { "JASUS" } + get_fieldset_statuses respond_to do |format| @@ -117,9 +129,6 @@ # intersection of both prject groups @projects = @projects & @tagged_projects_ids unless @tag_list.empty? - - debugger - end end end
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Thu Nov 17 14:52:13 2011 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Thu Nov 17 18:24:01 2011 +0000 @@ -18,9 +18,7 @@ # description, manager(s), creation date, last activity date, # general activity level, whether there is anything actually hosted # here for the project, etc. - def render_project_table_with_filtering(projects, question) - debugger - + def render_project_table_with_filtering(projects, question) custom_fields = "" s = "" if projects.any?