Commit 8147529e4b7c59391ae8acca67cc4459d9d79e51
Exists in
colab
and in
4 other branches
Merge pull request #177 from mezuro/reading_form
Fixed color picker javascript
Showing
5 changed files
with
24 additions
and
27 deletions
Show diff stats
app/views/readings/_form.html.erb
@@ -66,11 +66,7 @@ | @@ -66,11 +66,7 @@ | ||
66 | <script> | 66 | <script> |
67 | options = { | 67 | options = { |
68 | trigger_event: "click", | 68 | trigger_event: "click", |
69 | - color: { | ||
70 | - r: 0, | ||
71 | - g: 0, | ||
72 | - b: 0 | ||
73 | - }, | 69 | + color: $("#reading_color").val(), |
74 | onChange: function(colorHSB) { | 70 | onChange: function(colorHSB) { |
75 | // Get first children "eq(0)" of #color_div with type "input" | 71 | // Get first children "eq(0)" of #color_div with type "input" |
76 | $("#color_div").children("input").eq(0).val(colorHSB.toHex()); | 72 | $("#color_div").children("input").eq(0).val(colorHSB.toHex()); |
db/schema.rb
@@ -13,48 +13,48 @@ | @@ -13,48 +13,48 @@ | ||
13 | 13 | ||
14 | ActiveRecord::Schema.define(version: 20141211114023) do | 14 | ActiveRecord::Schema.define(version: 20141211114023) do |
15 | 15 | ||
16 | - create_table "kalibro_configuration_ownerships", force: true do |t| | 16 | + create_table "kalibro_configuration_ownerships", force: :cascade do |t| |
17 | t.integer "user_id" | 17 | t.integer "user_id" |
18 | t.integer "kalibro_configuration_id" | 18 | t.integer "kalibro_configuration_id" |
19 | t.datetime "created_at" | 19 | t.datetime "created_at" |
20 | t.datetime "updated_at" | 20 | t.datetime "updated_at" |
21 | end | 21 | end |
22 | 22 | ||
23 | - create_table "project_images", force: true do |t| | 23 | + create_table "project_images", force: :cascade do |t| |
24 | t.integer "project_id" | 24 | t.integer "project_id" |
25 | - t.string "url" | 25 | + t.string "url", limit: 255 |
26 | t.datetime "created_at" | 26 | t.datetime "created_at" |
27 | t.datetime "updated_at" | 27 | t.datetime "updated_at" |
28 | end | 28 | end |
29 | 29 | ||
30 | - create_table "project_ownerships", force: true do |t| | 30 | + create_table "project_ownerships", force: :cascade do |t| |
31 | t.integer "user_id" | 31 | t.integer "user_id" |
32 | t.integer "project_id" | 32 | t.integer "project_id" |
33 | t.datetime "created_at" | 33 | t.datetime "created_at" |
34 | t.datetime "updated_at" | 34 | t.datetime "updated_at" |
35 | end | 35 | end |
36 | 36 | ||
37 | - create_table "reading_group_ownerships", force: true do |t| | 37 | + create_table "reading_group_ownerships", force: :cascade do |t| |
38 | t.integer "user_id" | 38 | t.integer "user_id" |
39 | t.integer "reading_group_id" | 39 | t.integer "reading_group_id" |
40 | t.datetime "created_at" | 40 | t.datetime "created_at" |
41 | t.datetime "updated_at" | 41 | t.datetime "updated_at" |
42 | end | 42 | end |
43 | 43 | ||
44 | - create_table "users", force: true do |t| | ||
45 | - t.string "name", default: "", null: false | ||
46 | - t.string "email", default: "", null: false | 44 | + create_table "users", force: :cascade do |t| |
45 | + t.string "name", limit: 255, default: "", null: false | ||
46 | + t.string "email", limit: 255, default: "", null: false | ||
47 | t.datetime "created_at" | 47 | t.datetime "created_at" |
48 | t.datetime "updated_at" | 48 | t.datetime "updated_at" |
49 | - t.string "encrypted_password", default: "", null: false | ||
50 | - t.string "reset_password_token" | 49 | + t.string "encrypted_password", limit: 255, default: "", null: false |
50 | + t.string "reset_password_token", limit: 255 | ||
51 | t.datetime "reset_password_sent_at" | 51 | t.datetime "reset_password_sent_at" |
52 | t.datetime "remember_created_at" | 52 | t.datetime "remember_created_at" |
53 | - t.integer "sign_in_count", default: 0 | 53 | + t.integer "sign_in_count", default: 0 |
54 | t.datetime "current_sign_in_at" | 54 | t.datetime "current_sign_in_at" |
55 | t.datetime "last_sign_in_at" | 55 | t.datetime "last_sign_in_at" |
56 | - t.string "current_sign_in_ip" | ||
57 | - t.string "last_sign_in_ip" | 56 | + t.string "current_sign_in_ip", limit: 255 |
57 | + t.string "last_sign_in_ip", limit: 255 | ||
58 | end | 58 | end |
59 | 59 | ||
60 | add_index "users", ["email"], name: "index_users_on_email", unique: true | 60 | add_index "users", ["email"], name: "index_users_on_email", unique: true |
features/reading/edit.feature
@@ -9,10 +9,10 @@ Feature: Reading Edit | @@ -9,10 +9,10 @@ Feature: Reading Edit | ||
9 | And I am signed in | 9 | And I am signed in |
10 | And I own a sample reading group | 10 | And I own a sample reading group |
11 | And I have a sample reading within the sample reading group | 11 | And I have a sample reading within the sample reading group |
12 | - And I am at the Edit Reading page | ||
13 | - Then I fill the Label field with "Good" | ||
14 | - And I fill the Grade field with "10.5" | ||
15 | - And I fill the Color field with "33DD33" | 12 | + When I am at the Edit Reading page |
13 | + Then the field "Label" should be filled with "Good" | ||
14 | + And the field "Grade" should be filled with "10.5" | ||
15 | + And the field "Color" should be filled with "33DD33" | ||
16 | When I fill the Label field with "Bad" | 16 | When I fill the Label field with "Bad" |
17 | And I press the Save button | 17 | And I press the Save button |
18 | Then I should see "Bad" | 18 | Then I should see "Bad" |
@@ -33,13 +33,14 @@ Feature: Reading Edit | @@ -33,13 +33,14 @@ Feature: Reading Edit | ||
33 | And I should see "Color can't be blank" | 33 | And I should see "Color can't be blank" |
34 | 34 | ||
35 | @kalibro_configuration_restart | 35 | @kalibro_configuration_restart |
36 | - Scenario: editing a reading with already taken name | 36 | + Scenario: editing a reading with a name already taken |
37 | Given I am a regular user | 37 | Given I am a regular user |
38 | And I am signed in | 38 | And I am signed in |
39 | And I own a sample reading group | 39 | And I own a sample reading group |
40 | And I have a sample reading within the sample reading group labeled "Average" | 40 | And I have a sample reading within the sample reading group labeled "Average" |
41 | And I have a sample reading within the sample reading group labeled "Good" | 41 | And I have a sample reading within the sample reading group labeled "Good" |
42 | And I am at the Edit Reading page | 42 | And I am at the Edit Reading page |
43 | + Then the field "Label" should be filled with "Good" | ||
43 | When I fill the Label field with "Average" | 44 | When I fill the Label field with "Average" |
44 | And I press the Save button | 45 | And I press the Save button |
45 | Then I should see "Label Should be unique within a Reading Group" | 46 | Then I should see "Label Should be unique within a Reading Group" |
features/step_definitions/repository_steps.rb
@@ -117,10 +117,6 @@ Then(/^I should see the sample repository name$/) do | @@ -117,10 +117,6 @@ Then(/^I should see the sample repository name$/) do | ||
117 | expect(page).to have_content(@repository.name) | 117 | expect(page).to have_content(@repository.name) |
118 | end | 118 | end |
119 | 119 | ||
120 | -Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value| | ||
121 | - expect(page.find_field(field).value).to eq(value) | ||
122 | -end | ||
123 | - | ||
124 | Then(/^I should see the given module result$/) do | 120 | Then(/^I should see the given module result$/) do |
125 | expect(page).to have_content(@module_result.kalibro_module.name) | 121 | expect(page).to have_content(@module_result.kalibro_module.name) |
126 | end | 122 | end |
features/step_definitions/user_steps.rb
@@ -10,6 +10,10 @@ When(/^I fill the (.+) field with "(.+)"$/) do |field, text| | @@ -10,6 +10,10 @@ When(/^I fill the (.+) field with "(.+)"$/) do |field, text| | ||
10 | fill_in field, :with => text | 10 | fill_in field, :with => text |
11 | end | 11 | end |
12 | 12 | ||
13 | +Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value| | ||
14 | + expect(page.find_field(field).value).to eq(value) | ||
15 | +end | ||
16 | + | ||
13 | Then(/^my name should have changed to (.+)$/) do |text| | 17 | Then(/^my name should have changed to (.+)$/) do |text| |
14 | @user.reload | 18 | @user.reload |
15 | expect(@user.name).to eq(text) | 19 | expect(@user.name).to eq(text) |