This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| $.each( $(".submission_user_select"), function(key, el) { | |
| $(el).tokenInput("/teams/"+$(el).attr('data-team-id')+"/team_members.json", { | |
| crossDomain: false, | |
| prePopulate: $("#submission_user_id").data("pre"), | |
| hintText: "Type a member name...", | |
| tokenLimit: 1, | |
| propertyToSearch: "full_name", | |
| placeholder: "Type a member name...", | |
| theme: "facebook", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function(){ | |
| $('#response_note').enableSubmitOnType(); | |
| }); | |
| jQuery.fn.enableSubmitOnType = function() { | |
| $("input[type=submit]").attr("disabled", "disabled"); | |
| this.keyup(function(e){ | |
| var textInput = $(e.target); | |
| var formEl = $(textInput).closest('form'); | |
| var submitButton = $(formEl).find('input[type=submit]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RelationshipsController < ApplicationController | |
| before_filter :authenticate | |
| def create | |
| @user = User.find(params[:relationship][:followed_id]) | |
| current_user.follow!(@user) | |
| respond_to do |format| | |
| format.html { redirect_to @user } | |
| format.js | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create | |
| if params[:item_share] && params[:receiver] && params[:email] | |
| user = User.find_by_email(params[:item_share][:receiver][:email]) | |
| @item = Item.create!(params[:item_share][:item]) | |
| @item_share = current_user.item_shares_given.build(:item_id => @item.id, | |
| :share_target_user_id => user.id, | |
| :note => params[:item_share][:note]) | |
| if @item_share.save | |
| flash[:success] = "Item_share created!" | |
| redirect_to root_path |