# HG changeset patch # User luisf # Date 1365096185 -3600 # Node ID fe3777d42b7653a83b2d072c860f9e3327f3b019 # Parent 9523dff58d3d8a55a63a88334998073c2ac0a9c9 Started rewriting the projects#index JS functions. diff -r 9523dff58d3d -r fe3777d42b76 plugins/redmine_tags/app/views/projects/index.html.erb --- a/plugins/redmine_tags/app/views/projects/index.html.erb Wed Apr 03 16:34:04 2013 +0100 +++ b/plugins/redmine_tags/app/views/projects/index.html.erb Thu Apr 04 18:23:05 2013 +0100 @@ -4,7 +4,6 @@ <% end %> <%= javascript_include_tag 'projects_index', :plugin => 'redmine_tags' %> -
<%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%> <%= ('| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add')).html_safe if User.current.allowed_to?(:add_project, nil, :global => true) %> @@ -16,47 +15,34 @@
- <%- form_tag(:controller => :projects, :action => :index, :method => :get, :html => {:id => :project_filtering_form}, :remote => true) do -%> + <%= form_tag(:controller => :projects, :action => :index, :method => :get, :html => {:id => :project_filtering_form}, :remote => true) do -%> - <% if @filter_status=="true" %> -
- <%= l(:label_filter_plural) %> - <%- else -%> - +<%- end -%> -<%- end -%> -
-
<%= render :partial => 'filtered_projects' %>
- - - <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <% end %> diff -r 9523dff58d3d -r fe3777d42b76 plugins/redmine_tags/assets/javascripts/projects_index.js --- a/plugins/redmine_tags/assets/javascripts/projects_index.js Wed Apr 03 16:34:04 2013 +0100 +++ b/plugins/redmine_tags/assets/javascripts/projects_index.js Thu Apr 04 18:23:05 2013 +0100 @@ -1,25 +1,44 @@ -function toggleFieldsetWithState(this_field){ - id = Element.up(this_field, 'fieldset').id; +var IndexFilter = { + init: function(){ + var self = this; + $('fieldset#filters_fieldset legend').live("click", self.toggle); + }, - // is the fieldset collapsed? - var status = $(id).hasClassName("collapsed"); - change_session(id, status); + expanded: false, - toggleFieldset(this_field); -} + toggle: function(){ + var fieldset = $(this).parents('fieldset').first(); + fieldset.toggleClass('collapsed'); + fieldset.children('div').toggle(); + } +}; - function submitForm(){ - $('submitButton').click(); - } +/* + function toggleFieldsetWithState(obj){ + var fset = $(obj).parent('fieldset'); -function change_session(id, nstatus) { + // is the fieldset collapsed? + var status = fset.hasClass("collapsed"); + + // change_session(fset, status); + // toggleFieldset(fset); + } + + + function submitForm(){ + $('submitButton').click(); + } + + + 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 - }); -} + var request = new jQuery.ajax(url, { + method: 'post', + parameters: {field_id: id, status: nstatus}, + asynchronous: true + }); + } + function keypressHandler (event){ var key = event.which || event.keyCode; @@ -32,6 +51,9 @@ } } +*/ + $(document).ready(function(){ - $('search-input').on('keypress', keypressHandler); +// $('search-input').on('keypress', keypressHandler); + IndexFilter.init(); }); \ No newline at end of file