-
Notifications
You must be signed in to change notification settings - Fork 3
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
17 changed files
with
115 additions
and
15 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
Empty file.
2 changes: 1 addition & 1 deletion
2
app/controllers/api/activity_lines/lider/ya_lider/application_controller.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
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
18 changes: 16 additions & 2 deletions
18
app/forms/activity_lines/lider/ya_lider/participant_user_form.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 |
---|---|---|
@@ -1,4 +1,18 @@ | ||
class ActivityLines::Lider::YaLider::ParticipantUserForm < Reform::Form | ||
properties :email, :first_name, :last_name, :patronymic, :birth_date, :municipality, :locality, :school, :mobile_phone, | ||
:avatar | ||
properties :email, :first_name, :last_name, :patronymic, :birth_date, :municipality, :locality, :school, :mobile_phone | ||
|
||
validates :email, presence: true | ||
validates :first_name, presence: true | ||
validates :last_name, presence: true | ||
validates :patronymic, presence: true | ||
validates :birth_date, presence: true | ||
validates :municipality, presence: true | ||
validates :locality, presence: true | ||
validates :school, presence: true | ||
validates :mobile_phone, presence: true | ||
|
||
def submit(params) | ||
raise 'ApplicationForm::Params should not be nil' unless params | ||
save if validate params | ||
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
4 changes: 4 additions & 0 deletions
4
app/models/activity_lines/lider/ya_lider/participant_field.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,4 @@ | ||
class ActivityLines::Lider::YaLider::ParticipantField < ActiveRecord::Base | ||
extend Enumerize | ||
enumerize :title, in: [ :reason, :what_is_win_for_you, :quality, :if_i_have_one_million, :one_dream, :hobby, :life_plans ] | ||
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
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,9 @@ | ||
current_ya_lider = ActivityLines::Lider::YaLider.where(state: :active, | ||
contest_year: (DateTime.now.month > 8 ? DateTime.now.year + 1 : DateTime.now.year)).first | ||
if current_ya_lider.tokens.any? | ||
raise "You have already generated token".inspect | ||
else | ||
Token.create! record_id: current_ya_lider.id, record_type: 'ActivityLines::Lider::YaLider', | ||
content: SecureHelper.generate_token | ||
puts "#{Token.last.content}" | ||
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
11 changes: 11 additions & 0 deletions
11
db/migrate/20170119042814_create_activity_lines_lider_ya_lider_participant_fields.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,11 @@ | ||
class CreateActivityLinesLiderYaLiderParticipantFields < ActiveRecord::Migration | ||
def change | ||
create_table :activity_lines_lider_ya_lider_participant_fields do |t| | ||
t.integer :participant_id | ||
t.text :title | ||
t.text :value | ||
|
||
t.timestamps null: false | ||
end | ||
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
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
8 changes: 8 additions & 0 deletions
8
test/factories/activity_lines_lider_ya_lider_participant_fields.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,8 @@ | ||
FactoryGirl.define do | ||
factory :activity_lines_lider_ya_lider_participant_field, :class => 'ActivityLines::Lider::YaLider::ParticipantField' do | ||
participant_id 1 | ||
title "MyText" | ||
value "MyText" | ||
end | ||
|
||
end |