diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b3abcf6070fedf5afc52bfcadf1c3447d17b02c9..8b1cd73af1be9381d3a9ea9c9bcb27956977edb0 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -42,7 +42,7 @@ class GroupsController < ApplicationController def update @group = Group.first(:id => params[:id]) if @group.update_attributes(params[:group]) - flash[:notice] = "Successfully updated group." + #flash[:notice] = "Successfully updated group." redirect_to @group else render :action => 'edit' diff --git a/app/views/shared/_group_nav.haml b/app/views/shared/_group_nav.haml index 2d959b70befe2614b027c28c46afabc36e515e14..88995f9b55cdd3d73ac68a6c40355f859dd6fc7f 100644 --- a/app/views/shared/_group_nav.haml +++ b/app/views/shared/_group_nav.haml @@ -4,7 +4,8 @@ = link_to "All Groups", root_url - for group in @groups %li{:id => group.id, :class => ("selected" if current_group?(group))} - = link_for_group group + %span.group_name + = link_for_group group %span{:class => 'âš™'} = link_to "âš™", "#", :class => "edit_group_button" diff --git a/public/javascripts/view.js b/public/javascripts/view.js index f9fa6d194816221d472a3f78554decb8b6e37c30..782a1bdadd5c0e3b19f3ec2c1b6513efeb83e5dd 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -8,8 +8,6 @@ $(document).ready(function(){ $('#flash_notice, #flash_error, #flash_alert').delay(2500).slideUp(130); - - $("div.image_cycle").cycle({ fx: 'fade', random: 1, @@ -18,24 +16,60 @@ $(document).ready(function(){ }); //buttons////// - - $("#add_group_button").fancybox(); $("#add_request_button").fancybox({ 'titleShow': false }); - - - //pane_toggler_button("photo"); - $("input[type='submit']").addClass("button"); - - $(".image_cycle img").load( function() { $(this).fadeIn("slow"); }); + $(".edit_group_button").click(function() { + + var element = $(this).closest("li").children(".group_name").children("a"); + var oldHTML = element.html(); + + var link = element.attr("href"); + + element.toggleClass("editing"); + + if( element.hasClass("editing") ) { + + element.attr("contentEditable", true); + element.focus(); + + + + //remove newline action + $(element).keypress(function(e) { + if (e.which == 13) { + e.preventDefault(); + element.attr("contentEditable", false); + element.toggleClass("editing"); + element.blur(); + + //save changes + $.ajax({ + type: "PUT", + url: link, + data: {"group" : {"name" : element.text() }} + }); + } + }); + + //update all other group links + $(element).keyup(function(e) { + $("a[href='"+link+"']").not(element).text(element.text()); + }); + + } else { + element.attr("contentEditable", false); + } + + }); + });//end document ready diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 18c040055e66b02538b6eeaf451e301c0ae10bdc..3b9b768f501d8806de54ece97b7957f0930718aa 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -11,12 +11,10 @@ body { margin: 0; } a { - color: #018790; color: #556270; text-decoration: none; } a:hover { color: white; - background-color: #018790; background-color: #556270; } .avatar { @@ -473,6 +471,8 @@ h1.big_text { color: #999999; } #group_nav ul > li a:hover { background: none; } + #group_nav ul > li a.editable:hover { + background: yellow; } #group_nav ul .âš™ { margin-left: 4px; } #group_nav ul .âš™ a { @@ -569,3 +569,7 @@ h1.big_text { #global_search form label { font-size: 12px; margin-top: -3px; } + +.editing, .editing:hover { + background-color: yellow; + border: 1px #666666 solid; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 6c5c0c1178a26fa99230e86163e7bd726cb189ea..9ac21c0966df70c1547b8ac70e5e6dcb5c3f2b11 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -10,14 +10,12 @@ body :padding 2em :margin 0 a - :color #018790 :color #556270 :text :decoration none &:hover :color #fff :background - :color #018790 :color #556270 .avatar @@ -601,6 +599,8 @@ h1.big_text :color #999 &:hover :background none + &.editable:hover + :background yellow .âš™ :margin @@ -738,4 +738,7 @@ h1.big_text :margin :top -3px - +.editing, .editing:hover + :background + :color yellow + :border 1px #666 solid