-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
120 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
showExampleLabel = function() { | ||
var prefix = $('input#reaction-name-prefix').val(); | ||
var counter = parseInt($('input#reactions-count').val()); | ||
var user_name_abbr = $('input#name_abbreviation').val(); | ||
var reaction_label = user_name_abbr + '-' + prefix + (counter + 1) | ||
$('p#reaction-label-example').text(reaction_label); | ||
} | ||
|
||
$(function() { | ||
showExampleLabel(); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.container | ||
%h2 | ||
Change your user settings | ||
|
||
%br/ | ||
%br/ | ||
.jumbotron | ||
.row | ||
= form_for current_user, url: pages_update_user_path do |f| | ||
.field | ||
= text_field_tag :reaction_name_prefix, | ||
current_user.reaction_name_prefix, | ||
maxlength: 3, | ||
id: 'reaction-name-prefix', | ||
oninput: 'showExampleLabel();' | ||
= f.label :reaction_name_prefix | ||
.field | ||
= number_field_tag :reactions_count, | ||
current_user.counters['reactions'], | ||
min: 0, | ||
id: 'reactions-count', | ||
oninput: 'showExampleLabel();' | ||
= f.label :reactions_counter | ||
= hidden_field_tag :name_abbreviation, current_user.name_abbreviation | ||
|
||
%br/ | ||
|
||
%h3 | ||
Your next reaction label: | ||
%p{id: 'reaction-label-example'} | ||
|
||
.actions | ||
= f.submit "Update user settings", class: "btn btn-primary" | ||
|
||
%br/ | ||
%br/ | ||
|
||
= link_to "Back", root_path |
This file contains 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
5 changes: 5 additions & 0 deletions
5
db/migrate/20161109141353_add_reaction_name_prefix_to_user.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddReactionNamePrefixToUser < ActiveRecord::Migration | ||
def change | ||
add_column :users, :reaction_name_prefix, :string, default: 'R', limit: 3 | ||
end | ||
end |
This file contains 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
This file contains 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