group names are now editable
This commit is contained in:
parent
d2b471a58d
commit
239ae048cc
5 changed files with 59 additions and 17 deletions
|
|
@ -42,7 +42,7 @@ class GroupsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@group = Group.first(:id => params[:id])
|
@group = Group.first(:id => params[:id])
|
||||||
if @group.update_attributes(params[:group])
|
if @group.update_attributes(params[:group])
|
||||||
flash[:notice] = "Successfully updated group."
|
#flash[:notice] = "Successfully updated group."
|
||||||
redirect_to @group
|
redirect_to @group
|
||||||
else
|
else
|
||||||
render :action => 'edit'
|
render :action => 'edit'
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
= link_to "All Groups", root_url
|
= link_to "All Groups", root_url
|
||||||
- for group in @groups
|
- for group in @groups
|
||||||
%li{:id => group.id, :class => ("selected" if current_group?(group))}
|
%li{:id => group.id, :class => ("selected" if current_group?(group))}
|
||||||
|
%span.group_name
|
||||||
= link_for_group group
|
= link_for_group group
|
||||||
%span{:class => '⚙'}
|
%span{:class => '⚙'}
|
||||||
= link_to "⚙", "#", :class => "edit_group_button"
|
= link_to "⚙", "#", :class => "edit_group_button"
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ $(document).ready(function(){
|
||||||
|
|
||||||
$('#flash_notice, #flash_error, #flash_alert').delay(2500).slideUp(130);
|
$('#flash_notice, #flash_error, #flash_alert').delay(2500).slideUp(130);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("div.image_cycle").cycle({
|
$("div.image_cycle").cycle({
|
||||||
fx: 'fade',
|
fx: 'fade',
|
||||||
random: 1,
|
random: 1,
|
||||||
|
|
@ -18,24 +16,60 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
//buttons//////
|
//buttons//////
|
||||||
|
|
||||||
|
|
||||||
$("#add_group_button").fancybox();
|
$("#add_group_button").fancybox();
|
||||||
$("#add_request_button").fancybox({ 'titleShow': false });
|
$("#add_request_button").fancybox({ 'titleShow': false });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//pane_toggler_button("photo");
|
|
||||||
|
|
||||||
$("input[type='submit']").addClass("button");
|
$("input[type='submit']").addClass("button");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(".image_cycle img").load( function() {
|
$(".image_cycle img").load( function() {
|
||||||
$(this).fadeIn("slow");
|
$(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
|
});//end document ready
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,10 @@ body {
|
||||||
margin: 0; }
|
margin: 0; }
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #018790;
|
|
||||||
color: #556270;
|
color: #556270;
|
||||||
text-decoration: none; }
|
text-decoration: none; }
|
||||||
a:hover {
|
a:hover {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: #018790;
|
|
||||||
background-color: #556270; }
|
background-color: #556270; }
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
|
|
@ -473,6 +471,8 @@ h1.big_text {
|
||||||
color: #999999; }
|
color: #999999; }
|
||||||
#group_nav ul > li a:hover {
|
#group_nav ul > li a:hover {
|
||||||
background: none; }
|
background: none; }
|
||||||
|
#group_nav ul > li a.editable:hover {
|
||||||
|
background: yellow; }
|
||||||
#group_nav ul .⚙ {
|
#group_nav ul .⚙ {
|
||||||
margin-left: 4px; }
|
margin-left: 4px; }
|
||||||
#group_nav ul .⚙ a {
|
#group_nav ul .⚙ a {
|
||||||
|
|
@ -569,3 +569,7 @@ h1.big_text {
|
||||||
#global_search form label {
|
#global_search form label {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: -3px; }
|
margin-top: -3px; }
|
||||||
|
|
||||||
|
.editing, .editing:hover {
|
||||||
|
background-color: yellow;
|
||||||
|
border: 1px #666666 solid; }
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,12 @@ body
|
||||||
:padding 2em
|
:padding 2em
|
||||||
:margin 0
|
:margin 0
|
||||||
a
|
a
|
||||||
:color #018790
|
|
||||||
:color #556270
|
:color #556270
|
||||||
:text
|
:text
|
||||||
:decoration none
|
:decoration none
|
||||||
&:hover
|
&:hover
|
||||||
:color #fff
|
:color #fff
|
||||||
:background
|
:background
|
||||||
:color #018790
|
|
||||||
:color #556270
|
:color #556270
|
||||||
|
|
||||||
.avatar
|
.avatar
|
||||||
|
|
@ -601,6 +599,8 @@ h1.big_text
|
||||||
:color #999
|
:color #999
|
||||||
&:hover
|
&:hover
|
||||||
:background none
|
:background none
|
||||||
|
&.editable:hover
|
||||||
|
:background yellow
|
||||||
|
|
||||||
.⚙
|
.⚙
|
||||||
:margin
|
:margin
|
||||||
|
|
@ -738,4 +738,7 @@ h1.big_text
|
||||||
:margin
|
:margin
|
||||||
:top -3px
|
:top -3px
|
||||||
|
|
||||||
|
.editing, .editing:hover
|
||||||
|
:background
|
||||||
|
:color yellow
|
||||||
|
:border 1px #666 solid
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue