model_base_generators 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/example/app/controllers/issues_controller.rb +1 -1
- data/example/app/controllers/phases_controller.rb +62 -0
- data/example/app/helpers/phases_helper.rb +2 -0
- data/example/app/models/issue.rb +1 -0
- data/example/app/models/phase.rb +3 -0
- data/example/app/validations/issue_validation.rb +1 -0
- data/example/app/validations/phase_validation.rb +10 -0
- data/example/app/validations/project_validation.rb +1 -0
- data/example/app/views/issues/_form.html.erb +7 -0
- data/example/app/views/issues/_table.html.erb +2 -0
- data/example/app/views/issues/show.html.erb +2 -0
- data/example/app/views/phases/_form.html.erb +55 -0
- data/example/app/views/phases/_table.html.erb +31 -0
- data/example/app/views/phases/edit.html.erb +5 -0
- data/example/app/views/phases/index.html.erb +9 -0
- data/example/app/views/phases/new.html.erb +5 -0
- data/example/app/views/phases/show.html.erb +25 -0
- data/example/config/application.rb +5 -1
- data/example/config/locales/devise.ja.yml +63 -0
- data/example/config/locales/rails.ja.yml +202 -0
- data/example/config/routes.rb +1 -0
- data/example/db/schema.rb +9 -0
- data/example/spec/controllers/phases_controller_spec.rb +170 -0
- data/example/spec/factories/issues.rb +1 -0
- data/example/spec/factories/phases.rb +8 -0
- data/example/spec/factories/project_assignments.rb +2 -2
- data/example/spec/routing/phases_routing_spec.rb +39 -0
- data/example/spec/views/issues/edit.html.erb_spec.rb +1 -0
- data/example/spec/views/issues/index.html.erb_spec.rb +1 -0
- data/example/spec/views/issues/new.html.erb_spec.rb +1 -0
- data/example/spec/views/issues/show.html.erb_spec.rb +1 -0
- data/example/spec/views/phases/edit.html.erb_spec.rb +20 -0
- data/example/spec/views/phases/index.html.erb_spec.rb +21 -0
- data/example/spec/views/phases/new.html.erb_spec.rb +20 -0
- data/example/spec/views/phases/show.html.erb_spec.rb +17 -0
- data/example/spec/views/project_assignments/index.html.erb_spec.rb +2 -2
- data/example/spec/views/project_assignments/show.html.erb_spec.rb +2 -2
- data/lib/model_base/column_attribute.rb +3 -3
- data/lib/model_base/version.rb +1 -1
- data/lib/templates/erb/scaffold/_table.html.erb +4 -0
- data/lib/templates/erb/scaffold/show.html.erb +4 -0
- data/lib/templates/factory_girl/factory.rb +4 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ffe879896645ad2881f5d7cea65acff0493005
|
4
|
+
data.tar.gz: e2e5796a4879d9081a16bedcb8c5babbedebabca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f259992f73231c6d76d80bab1bd9c0fec301aec36accc1745a84c27ef354629c48e5955a2e4dce7c9b717e96aa3764b960898ab47486c3af286583d1d0d39b4d
|
7
|
+
data.tar.gz: c38fa3e58ff852a795226ce9fca1496ace9b62493a1a13c295c8520ffab1e9c742698db24dba08a712d17d69b72a2924cd571200a5c90dbdbce254675f310b9e
|
@@ -57,6 +57,6 @@ class IssuesController < ApplicationController
|
|
57
57
|
|
58
58
|
# Only allow a trusted parameter "white list" through.
|
59
59
|
def issue_params
|
60
|
-
params.require(:issue).permit(:project_id, :title, :status, :creator_id)
|
60
|
+
params.require(:issue).permit(:project_id, :title, :status, :creator_id, :assignee_id)
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class PhasesController < ApplicationController
|
2
|
+
include Authentication
|
3
|
+
load_and_authorize_resource except: [:index]
|
4
|
+
|
5
|
+
before_action :set_phase, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /phases
|
8
|
+
def index
|
9
|
+
@phases = Phase.all
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /phases/1
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /phases/new
|
17
|
+
def new
|
18
|
+
@phase = Phase.new
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET /phases/1/edit
|
22
|
+
def edit
|
23
|
+
end
|
24
|
+
|
25
|
+
# POST /phases
|
26
|
+
def create
|
27
|
+
@phase = Phase.new(phase_params)
|
28
|
+
|
29
|
+
if @phase.save
|
30
|
+
redirect_to @phase, notice: 'Phase was successfully created.'
|
31
|
+
else
|
32
|
+
render :new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# PATCH/PUT /phases/1
|
37
|
+
def update
|
38
|
+
if @phase.update(phase_params)
|
39
|
+
redirect_to @phase, notice: 'Phase was successfully updated.'
|
40
|
+
else
|
41
|
+
render :edit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# DELETE /phases/1
|
46
|
+
def destroy
|
47
|
+
@phase.destroy
|
48
|
+
redirect_to phases_url, notice: 'Phase was successfully destroyed.'
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
# Use callbacks to share common setup or constraints between actions.
|
54
|
+
def set_phase
|
55
|
+
@phase = Phase.find(params[:id])
|
56
|
+
end
|
57
|
+
|
58
|
+
# Only allow a trusted parameter "white list" through.
|
59
|
+
def phase_params
|
60
|
+
params.require(:phase).permit(:project_id, :name, :started_at, :finished_at)
|
61
|
+
end
|
62
|
+
end
|
data/example/app/models/issue.rb
CHANGED
@@ -43,6 +43,13 @@
|
|
43
43
|
</div>
|
44
44
|
<%=f.error_span(:creator_id) %>
|
45
45
|
</div>
|
46
|
+
<div class="form-group">
|
47
|
+
<%= f.label :assignee_id, :class => 'control-label col-lg-2' %>
|
48
|
+
<div class="col-lg-10">
|
49
|
+
<%= f.collection_select :assignee_id, User.all, :id, :email, {include_blank: true}, :class=>"form-control" %>
|
50
|
+
</div>
|
51
|
+
<%=f.error_span(:assignee_id) %>
|
52
|
+
</div>
|
46
53
|
|
47
54
|
<div class="form-group">
|
48
55
|
<div class="col-lg-offset-2 col-lg-10">
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<th><%= model_class.human_attribute_name(:title) %></th>
|
7
7
|
<th><%= model_class.human_attribute_name(:status) %></th>
|
8
8
|
<th><%= model_class.human_attribute_name(:creator_id) %></th>
|
9
|
+
<th><%= model_class.human_attribute_name(:assignee_id) %></th>
|
9
10
|
<th><%= model_class.human_attribute_name(:created_at) %></th>
|
10
11
|
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
11
12
|
</tr>
|
@@ -17,6 +18,7 @@
|
|
17
18
|
<td><%= link_to issue.title, issue_path(issue) %></td>
|
18
19
|
<td><%= issue.status_text %></td>
|
19
20
|
<td><%= issue.creator.email %></td>
|
21
|
+
<td><%= issue.assignee.try(:email) %></td>
|
20
22
|
<td><%=l issue.created_at %></td>
|
21
23
|
<td>
|
22
24
|
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
@@ -12,6 +12,8 @@
|
|
12
12
|
<dd><%= @issue.status_text %></dd>
|
13
13
|
<dt><strong><%= model_class.human_attribute_name(:creator_id) %>:</strong></dt>
|
14
14
|
<dd><%= @issue.creator.email %></dd>
|
15
|
+
<dt><strong><%= model_class.human_attribute_name(:assignee_id) %>:</strong></dt>
|
16
|
+
<dd><%= @issue.assignee.try(:email) %></dd>
|
15
17
|
<dt><strong><%= model_class.human_attribute_name(:created_at) %>:</strong></dt>
|
16
18
|
<dd><%=l @issue.created_at %></dd>
|
17
19
|
<dt><strong><%= model_class.human_attribute_name(:updated_at) %>:</strong></dt>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<%= form_for phase, :html => { :class => "form-horizontal phase" } do |f| %>
|
2
|
+
|
3
|
+
<% if phase.errors.any? %>
|
4
|
+
<div id="error_expl" class="panel panel-danger">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<h3 class="panel-title"><%= pluralize(phase.errors.count, "error") %> prohibited this phase from being saved:</h3>
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<ul>
|
10
|
+
<% phase.errors.full_messages.each do |msg| %>
|
11
|
+
<li><%= msg %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<div class="form-group">
|
19
|
+
<%= f.label :project_id, :class => 'control-label col-lg-2' %>
|
20
|
+
<div class="col-lg-10">
|
21
|
+
<%= f.collection_select :project_id, Project.all, :id, :name, {}, :class=>"form-control" %>
|
22
|
+
</div>
|
23
|
+
<%=f.error_span(:project_id) %>
|
24
|
+
</div>
|
25
|
+
<div class="form-group">
|
26
|
+
<%= f.label :name, :class => 'control-label col-lg-2' %>
|
27
|
+
<div class="col-lg-10">
|
28
|
+
<%= f.text_field :name, :class => 'form-control' %>
|
29
|
+
</div>
|
30
|
+
<%=f.error_span(:name) %>
|
31
|
+
</div>
|
32
|
+
<div class="form-group">
|
33
|
+
<%= f.label :started_at, :class => 'control-label col-lg-2' %>
|
34
|
+
<div class="col-lg-10">
|
35
|
+
<%= f.datetime_select :started_at, :class => 'form-control' %>
|
36
|
+
</div>
|
37
|
+
<%=f.error_span(:started_at) %>
|
38
|
+
</div>
|
39
|
+
<div class="form-group">
|
40
|
+
<%= f.label :finished_at, :class => 'control-label col-lg-2' %>
|
41
|
+
<div class="col-lg-10">
|
42
|
+
<%= f.datetime_select :finished_at, :class => 'form-control' %>
|
43
|
+
</div>
|
44
|
+
<%=f.error_span(:finished_at) %>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="form-group">
|
48
|
+
<div class="col-lg-offset-2 col-lg-10">
|
49
|
+
<%= f.submit nil, :class => 'btn btn-primary' %>
|
50
|
+
<%= link_to t('.cancel', :default => t("helpers.links.cancel")),
|
51
|
+
phases_path, :class => 'btn btn-default' %>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%- model_class = Phase -%>
|
2
|
+
<table class="table table-striped">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th><%= model_class.human_attribute_name(:project_id) %></th>
|
6
|
+
<th><%= model_class.human_attribute_name(:name) %></th>
|
7
|
+
<th><%= model_class.human_attribute_name(:started_at) %></th>
|
8
|
+
<th><%= model_class.human_attribute_name(:finished_at) %></th>
|
9
|
+
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% @phases.each do |phase| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= phase.project.name %></td>
|
16
|
+
<td><%= link_to phase.name, phase_path(phase) %></td>
|
17
|
+
<td><%=l phase.started_at %></td>
|
18
|
+
<td><%=l phase.finished_at %></td>
|
19
|
+
<td>
|
20
|
+
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
21
|
+
edit_phase_path(phase), :class => 'btn btn-default btn-xs' %>
|
22
|
+
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
|
23
|
+
phase_path(phase),
|
24
|
+
:method => :delete,
|
25
|
+
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
|
26
|
+
:class => 'btn btn-xs btn-danger' %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%- model_class = Phase -%>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
|
4
|
+
</div>
|
5
|
+
<%= render 'phases/table' %>
|
6
|
+
|
7
|
+
<%= link_to t('.new', :default => t("helpers.links.new")),
|
8
|
+
new_phase_path,
|
9
|
+
:class => 'btn btn-primary' %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- model_class = Phase -%>
|
2
|
+
<div class="page-header">
|
3
|
+
<h1><%=t '.title', :default => model_class.model_name.human.titleize %></h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<dl class="dl-horizontal">
|
7
|
+
<dt><strong><%= model_class.human_attribute_name(:project_id) %>:</strong></dt>
|
8
|
+
<dd><%= @phase.project.name %></dd>
|
9
|
+
<dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
|
10
|
+
<dd><%= @phase.name %></dd>
|
11
|
+
<dt><strong><%= model_class.human_attribute_name(:started_at) %>:</strong></dt>
|
12
|
+
<dd><%=l @phase.started_at %></dd>
|
13
|
+
<dt><strong><%= model_class.human_attribute_name(:finished_at) %>:</strong></dt>
|
14
|
+
<dd><%=l @phase.finished_at %></dd>
|
15
|
+
</dl>
|
16
|
+
|
17
|
+
<%= link_to t('.back', :default => t("helpers.links.back")),
|
18
|
+
phases_path, :class => 'btn btn-default' %>
|
19
|
+
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
20
|
+
edit_phase_path(@phase), :class => 'btn btn-default' %>
|
21
|
+
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
|
22
|
+
phase_path(@phase),
|
23
|
+
:method => 'delete',
|
24
|
+
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
|
25
|
+
:class => 'btn btn-danger' %>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
ja:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
not_found: "は見つかりませんでした"
|
5
|
+
# not_found: "not found"
|
6
|
+
already_confirmed: "は既に登録済みです"
|
7
|
+
# already_confirmed: "was already confirmed"
|
8
|
+
not_locked: "は凍結されていません"
|
9
|
+
# not_locked: "was not locked"
|
10
|
+
|
11
|
+
devise:
|
12
|
+
failure:
|
13
|
+
unauthenticated: 'ログインしてください。'
|
14
|
+
# unauthenticated: 'You need to sign in or sign up before continuing.'
|
15
|
+
unconfirmed: '本登録を行ってください。'
|
16
|
+
# unconfirmed: 'You have to confirm your account before continuing.'
|
17
|
+
locked: 'あなたのアカウントは凍結されています。'
|
18
|
+
# locked: 'Your account is locked.'
|
19
|
+
invalid: 'メールアドレスかパスワードが違います。'
|
20
|
+
# invalid: 'Invalid email or password.'
|
21
|
+
invalid_token: '認証キーが不正です。'
|
22
|
+
# invalid_token: 'Invalid authentication token.'
|
23
|
+
timeout: 'セッションがタイムアウトしました。もう一度ログインしてください。'
|
24
|
+
# timeout: 'Your session expired, please sign in again to continue.'
|
25
|
+
inactive: 'アカウントがアクティベートされていません。'
|
26
|
+
# inactive: 'Your account was not activated yet.'
|
27
|
+
sessions:
|
28
|
+
signed_in: 'ログインしました。'
|
29
|
+
# signed_in: 'Signed in successfully.'
|
30
|
+
signed_out: 'ログアウトしました。'
|
31
|
+
# signed_out: 'Signed out successfully.'
|
32
|
+
passwords:
|
33
|
+
send_instructions: 'パスワードのリセット方法を数分以内にメールでご連絡します。'
|
34
|
+
# send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
35
|
+
updated: 'パスワードを変更しました。'
|
36
|
+
# updated: 'Your password was changed successfully. You are now signed in.'
|
37
|
+
confirmations:
|
38
|
+
send_instructions: '登録方法を数分以内にメールでご連絡します。'
|
39
|
+
# send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
40
|
+
confirmed: 'アカウントを登録しました。'
|
41
|
+
# confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
42
|
+
registrations:
|
43
|
+
signed_up: 'アカウント登録を受け付けました。確認のメールをお送りします。'
|
44
|
+
# signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
45
|
+
updated: 'アカウントを更新しました。'
|
46
|
+
# updated: 'You updated your account successfully.'
|
47
|
+
destroyed: 'アカウントを削除しました。またのご利用をお待ちしております。'
|
48
|
+
# destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
49
|
+
unlocks:
|
50
|
+
send_instructions: 'アカウントの凍結解除方法を数分以内にメールでご連絡します。'
|
51
|
+
# send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
52
|
+
unlocked: 'アカウントを凍結解除しました。'
|
53
|
+
# unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
54
|
+
mailer:
|
55
|
+
confirmation_instructions:
|
56
|
+
subject: 'アカウントの登録方法'
|
57
|
+
# subject: 'Confirmation instructions'
|
58
|
+
reset_password_instructions:
|
59
|
+
subject: 'パスワードの再設定'
|
60
|
+
# subject: 'Reset password instructions'
|
61
|
+
unlock_instructions:
|
62
|
+
subject: 'アカウントの凍結解除'
|
63
|
+
# subject: 'Unlock Instructions'
|
@@ -0,0 +1,202 @@
|
|
1
|
+
---
|
2
|
+
ja:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
messages:
|
6
|
+
record_invalid: "バリデーションに失敗しました: %{errors}"
|
7
|
+
restrict_dependent_destroy:
|
8
|
+
has_one: "%{record}が存在しているので削除できません"
|
9
|
+
has_many: "%{record}が存在しているので削除できません"
|
10
|
+
date:
|
11
|
+
abbr_day_names:
|
12
|
+
- 日
|
13
|
+
- 月
|
14
|
+
- 火
|
15
|
+
- 水
|
16
|
+
- 木
|
17
|
+
- 金
|
18
|
+
- 土
|
19
|
+
abbr_month_names:
|
20
|
+
-
|
21
|
+
- 1月
|
22
|
+
- 2月
|
23
|
+
- 3月
|
24
|
+
- 4月
|
25
|
+
- 5月
|
26
|
+
- 6月
|
27
|
+
- 7月
|
28
|
+
- 8月
|
29
|
+
- 9月
|
30
|
+
- 10月
|
31
|
+
- 11月
|
32
|
+
- 12月
|
33
|
+
day_names:
|
34
|
+
- 日曜日
|
35
|
+
- 月曜日
|
36
|
+
- 火曜日
|
37
|
+
- 水曜日
|
38
|
+
- 木曜日
|
39
|
+
- 金曜日
|
40
|
+
- 土曜日
|
41
|
+
formats:
|
42
|
+
default: "%Y/%m/%d"
|
43
|
+
long: "%Y年%m月%d日(%a)"
|
44
|
+
short: "%m/%d"
|
45
|
+
month_names:
|
46
|
+
-
|
47
|
+
- 1月
|
48
|
+
- 2月
|
49
|
+
- 3月
|
50
|
+
- 4月
|
51
|
+
- 5月
|
52
|
+
- 6月
|
53
|
+
- 7月
|
54
|
+
- 8月
|
55
|
+
- 9月
|
56
|
+
- 10月
|
57
|
+
- 11月
|
58
|
+
- 12月
|
59
|
+
order:
|
60
|
+
- :year
|
61
|
+
- :month
|
62
|
+
- :day
|
63
|
+
datetime:
|
64
|
+
distance_in_words:
|
65
|
+
about_x_hours:
|
66
|
+
one: 約1時間
|
67
|
+
other: 約%{count}時間
|
68
|
+
about_x_months:
|
69
|
+
one: 約1ヶ月
|
70
|
+
other: 約%{count}ヶ月
|
71
|
+
about_x_years:
|
72
|
+
one: 約1年
|
73
|
+
other: 約%{count}年
|
74
|
+
almost_x_years:
|
75
|
+
one: 1年弱
|
76
|
+
other: "%{count}年弱"
|
77
|
+
half_a_minute: 30秒前後
|
78
|
+
less_than_x_minutes:
|
79
|
+
one: 1分以内
|
80
|
+
other: "%{count}分未満"
|
81
|
+
less_than_x_seconds:
|
82
|
+
one: 1秒以内
|
83
|
+
other: "%{count}秒未満"
|
84
|
+
over_x_years:
|
85
|
+
one: 1年以上
|
86
|
+
other: "%{count}年以上"
|
87
|
+
x_days:
|
88
|
+
one: 1日
|
89
|
+
other: "%{count}日"
|
90
|
+
x_minutes:
|
91
|
+
one: 1分
|
92
|
+
other: "%{count}分"
|
93
|
+
x_months:
|
94
|
+
one: 1ヶ月
|
95
|
+
other: "%{count}ヶ月"
|
96
|
+
x_seconds:
|
97
|
+
one: 1秒
|
98
|
+
other: "%{count}秒"
|
99
|
+
prompts:
|
100
|
+
day: 日
|
101
|
+
hour: 時
|
102
|
+
minute: 分
|
103
|
+
month: 月
|
104
|
+
second: 秒
|
105
|
+
year: 年
|
106
|
+
errors:
|
107
|
+
format: "%{attribute}%{message}"
|
108
|
+
messages:
|
109
|
+
accepted: を受諾してください
|
110
|
+
blank: を入力してください
|
111
|
+
present: は入力しないでください
|
112
|
+
confirmation: と%{attribute}の入力が一致しません
|
113
|
+
empty: を入力してください
|
114
|
+
equal_to: は%{count}にしてください
|
115
|
+
even: は偶数にしてください
|
116
|
+
exclusion: は予約されています
|
117
|
+
greater_than: は%{count}より大きい値にしてください
|
118
|
+
greater_than_or_equal_to: は%{count}以上の値にしてください
|
119
|
+
inclusion: は一覧にありません
|
120
|
+
invalid: は不正な値です
|
121
|
+
less_than: は%{count}より小さい値にしてください
|
122
|
+
less_than_or_equal_to: は%{count}以下の値にしてください
|
123
|
+
model_invalid: "バリデーションに失敗しました: %{errors}"
|
124
|
+
not_a_number: は数値で入力してください
|
125
|
+
not_an_integer: は整数で入力してください
|
126
|
+
odd: は奇数にしてください
|
127
|
+
required: を入力してください
|
128
|
+
taken: はすでに存在します
|
129
|
+
too_long: は%{count}文字以内で入力してください
|
130
|
+
too_short: は%{count}文字以上で入力してください
|
131
|
+
wrong_length: は%{count}文字で入力してください
|
132
|
+
other_than: は%{count}以外の値にしてください
|
133
|
+
template:
|
134
|
+
body: 次の項目を確認してください
|
135
|
+
header:
|
136
|
+
one: "%{model}にエラーが発生しました"
|
137
|
+
other: "%{model}に%{count}個のエラーが発生しました"
|
138
|
+
helpers:
|
139
|
+
select:
|
140
|
+
prompt: 選択してください
|
141
|
+
submit:
|
142
|
+
create: 登録する
|
143
|
+
submit: 保存する
|
144
|
+
update: 更新する
|
145
|
+
number:
|
146
|
+
currency:
|
147
|
+
format:
|
148
|
+
delimiter: ","
|
149
|
+
format: "%n%u"
|
150
|
+
precision: 0
|
151
|
+
separator: "."
|
152
|
+
significant: false
|
153
|
+
strip_insignificant_zeros: false
|
154
|
+
unit: 円
|
155
|
+
format:
|
156
|
+
delimiter: ","
|
157
|
+
precision: 3
|
158
|
+
separator: "."
|
159
|
+
significant: false
|
160
|
+
strip_insignificant_zeros: false
|
161
|
+
human:
|
162
|
+
decimal_units:
|
163
|
+
format: "%n %u"
|
164
|
+
units:
|
165
|
+
billion: 十億
|
166
|
+
million: 百万
|
167
|
+
quadrillion: 千兆
|
168
|
+
thousand: 千
|
169
|
+
trillion: 兆
|
170
|
+
unit: ''
|
171
|
+
format:
|
172
|
+
delimiter: ''
|
173
|
+
precision: 3
|
174
|
+
significant: true
|
175
|
+
strip_insignificant_zeros: true
|
176
|
+
storage_units:
|
177
|
+
format: "%n%u"
|
178
|
+
units:
|
179
|
+
byte: バイト
|
180
|
+
gb: GB
|
181
|
+
kb: KB
|
182
|
+
mb: MB
|
183
|
+
tb: TB
|
184
|
+
percentage:
|
185
|
+
format:
|
186
|
+
delimiter: ''
|
187
|
+
format: "%n%"
|
188
|
+
precision:
|
189
|
+
format:
|
190
|
+
delimiter: ''
|
191
|
+
support:
|
192
|
+
array:
|
193
|
+
last_word_connector: と
|
194
|
+
two_words_connector: と
|
195
|
+
words_connector: と
|
196
|
+
time:
|
197
|
+
am: 午前
|
198
|
+
formats:
|
199
|
+
default: "%Y/%m/%d %H:%M:%S"
|
200
|
+
long: "%Y年%m月%d日(%a) %H時%M分%S秒 %z"
|
201
|
+
short: "%y/%m/%d %H:%M"
|
202
|
+
pm: 午後
|
data/example/config/routes.rb
CHANGED
data/example/db/schema.rb
CHANGED
@@ -23,6 +23,13 @@ ActiveRecord::Schema.define(version: 20161013025452) do
|
|
23
23
|
end
|
24
24
|
add_foreign_key :projects, :users, column: 'owner_id'
|
25
25
|
|
26
|
+
create_table :phases do |t|
|
27
|
+
t.references :project , null: false, foreign_key: true
|
28
|
+
t.string :name , null: false
|
29
|
+
t.datetime :started_at , null: false
|
30
|
+
t.datetime :finished_at, null: false
|
31
|
+
end
|
32
|
+
|
26
33
|
create_table :project_assignments do |t|
|
27
34
|
t.references :project, null: false, foreign_key: true
|
28
35
|
t.references :user , null: false, foreign_key: true
|
@@ -36,8 +43,10 @@ ActiveRecord::Schema.define(version: 20161013025452) do
|
|
36
43
|
t.string :title, null: false
|
37
44
|
t.integer :status, null: false
|
38
45
|
t.references :creator, null: false
|
46
|
+
t.references :assignee, null: true
|
39
47
|
t.datetime :created_at, null: false
|
40
48
|
t.datetime :updated_at, null: false
|
41
49
|
end
|
42
50
|
add_foreign_key :issues, :users, column: 'creator_id'
|
51
|
+
add_foreign_key :issues, :users, column: 'assignee_id'
|
43
52
|
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
20
|
+
|
21
|
+
RSpec.describe PhasesController, type: :controller do
|
22
|
+
|
23
|
+
let(:project){ FactoryGirl.create(:project, owner: user) }
|
24
|
+
let(:user){ FactoryGirl.create(:user) }
|
25
|
+
before{ devise_user_login(user) }
|
26
|
+
|
27
|
+
let(:phase){ FactoryGirl.create(:phase, project: project) }
|
28
|
+
|
29
|
+
# This should return the minimal set of attributes required to create a valid
|
30
|
+
# Phase. As you add validations to Phase, be sure to
|
31
|
+
# adjust the attributes here as well.
|
32
|
+
let(:valid_parameters) {
|
33
|
+
FactoryGirl.attributes_for(:phase).merge(project_id: project.id)
|
34
|
+
}
|
35
|
+
|
36
|
+
let(:invalid_parameters) {
|
37
|
+
valid_parameters.symbolize_keys.merge(name: '')
|
38
|
+
}
|
39
|
+
|
40
|
+
# This should return the minimal set of values that should be in the session
|
41
|
+
# in order to pass any filters (e.g. authentication) defined in
|
42
|
+
# PhasesController. Be sure to keep this updated too.
|
43
|
+
let(:valid_session) { {} }
|
44
|
+
|
45
|
+
describe "GET #index" do
|
46
|
+
it "assigns all phases as @phases" do
|
47
|
+
get :index, params: {}, session: valid_session
|
48
|
+
expect(assigns(:phases)).to eq([phase])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "GET #show" do
|
53
|
+
it "assigns the requested phase as @phase" do
|
54
|
+
phase # To create phase
|
55
|
+
get :show, params: {:id => phase.to_param}, session: valid_session
|
56
|
+
expect(assigns(:phase)).to eq(phase)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "GET #new" do
|
61
|
+
it "assigns a new phase as @phase" do
|
62
|
+
get :new, params: {}, session: valid_session
|
63
|
+
expect(assigns(:phase)).to be_a_new(Phase)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "GET #edit" do
|
68
|
+
it "assigns the requested phase as @phase" do
|
69
|
+
phase # To create phase
|
70
|
+
get :edit, params: {:id => phase.to_param}, session: valid_session
|
71
|
+
expect(assigns(:phase)).to eq(phase)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "POST #create" do
|
76
|
+
context "with valid params" do
|
77
|
+
it "creates a new Phase" do
|
78
|
+
expect {
|
79
|
+
post :create, params: {:phase => valid_parameters}, session: valid_session
|
80
|
+
}.to change(Phase, :count).by(1)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "assigns a newly created phase as @phase" do
|
84
|
+
post :create, params: {:phase => valid_parameters}, session: valid_session
|
85
|
+
expect(assigns(:phase)).to be_a(Phase)
|
86
|
+
expect(assigns(:phase)).to be_persisted
|
87
|
+
end
|
88
|
+
|
89
|
+
it "redirects to the created phase" do
|
90
|
+
post :create, params: {:phase => valid_parameters}, session: valid_session
|
91
|
+
expect(response).to redirect_to(Phase.last)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "with invalid params" do
|
96
|
+
it "assigns a newly created but unsaved phase as @phase" do
|
97
|
+
post :create, params: {:phase => invalid_parameters}, session: valid_session
|
98
|
+
expect(assigns(:phase)).to be_a_new(Phase)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "re-renders the 'new' template" do
|
102
|
+
post :create, params: {:phase => invalid_parameters}, session: valid_session
|
103
|
+
expect(response).to render_template("new")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "PUT #update" do
|
109
|
+
context "with valid params" do
|
110
|
+
let(:new_name){ valid_parameters[:name].succ }
|
111
|
+
let(:new_started_at){ valid_parameters[:started_at].succ }
|
112
|
+
let(:new_finished_at){ valid_parameters[:finished_at].succ }
|
113
|
+
|
114
|
+
let(:new_parameters) {
|
115
|
+
valid_parameters.merge(name: new_name, started_at: new_started_at, finished_at: new_finished_at)
|
116
|
+
}
|
117
|
+
|
118
|
+
it "updates the requested phase" do
|
119
|
+
phase # To create phase
|
120
|
+
put :update, params: {:id => phase.to_param, :phase => new_parameters}, session: valid_session
|
121
|
+
phase.reload
|
122
|
+
expect(phase.name).to eq new_name
|
123
|
+
expect(phase.started_at).to eq new_started_at
|
124
|
+
expect(phase.finished_at).to eq new_finished_at
|
125
|
+
end
|
126
|
+
|
127
|
+
it "assigns the requested phase as @phase" do
|
128
|
+
phase # To create phase
|
129
|
+
put :update, params: {:id => phase.to_param, :phase => new_parameters}, session: valid_session
|
130
|
+
expect(assigns(:phase)).to eq(phase)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "redirects to the phase" do
|
134
|
+
phase # To create phase
|
135
|
+
put :update, params: {:id => phase.to_param, :phase => new_parameters}, session: valid_session
|
136
|
+
expect(response).to redirect_to(phase)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "with invalid params" do
|
141
|
+
it "assigns the phase as @phase" do
|
142
|
+
phase # To create phase
|
143
|
+
put :update, params: {:id => phase.to_param, :phase => invalid_parameters}, session: valid_session
|
144
|
+
expect(assigns(:phase)).to eq(phase)
|
145
|
+
end
|
146
|
+
|
147
|
+
it "re-renders the 'edit' template" do
|
148
|
+
phase # To create phase
|
149
|
+
put :update, params: {:id => phase.to_param, :phase => invalid_parameters}, session: valid_session
|
150
|
+
expect(response).to render_template("edit")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe "DELETE #destroy" do
|
156
|
+
it "destroys the requested phase" do
|
157
|
+
phase # To create phase
|
158
|
+
expect {
|
159
|
+
delete :destroy, params: {:id => phase.to_param}, session: valid_session
|
160
|
+
}.to change(Phase, :count).by(-1)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "redirects to the phases list" do
|
164
|
+
phase # To create phase
|
165
|
+
delete :destroy, params: {:id => phase.to_param}, session: valid_session
|
166
|
+
expect(response).to redirect_to(phases_url)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
@@ -2,7 +2,7 @@ FactoryGirl.define do
|
|
2
2
|
factory :project_assignment do
|
3
3
|
association :project, factory: :project
|
4
4
|
association :user, factory: :user
|
5
|
-
started_at "2020-03-22 09:50:00"
|
6
|
-
finished_at "2020-03-22 23:40:00"
|
5
|
+
started_at "2020-03-22 09:50:00 +09:00"
|
6
|
+
finished_at "2020-03-22 23:40:00 +09:00"
|
7
7
|
end
|
8
8
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.describe PhasesController, type: :routing do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
expect(:get => "/phases").to route_to("phases#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
expect(:get => "/phases/new").to route_to("phases#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
expect(:get => "/phases/1").to route_to("phases#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #edit" do
|
19
|
+
expect(:get => "/phases/1/edit").to route_to("phases#edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #create" do
|
23
|
+
expect(:post => "/phases").to route_to("phases#create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "routes to #update via PUT" do
|
27
|
+
expect(:put => "/phases/1").to route_to("phases#update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "routes to #update via PATCH" do
|
31
|
+
expect(:patch => "/phases/1").to route_to("phases#update", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "routes to #destroy" do
|
35
|
+
expect(:delete => "/phases/1").to route_to("phases#destroy", :id => "1")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -15,6 +15,7 @@ RSpec.describe "issues/edit", type: :view do
|
|
15
15
|
assert_select "input#issue_title[name=?]", "issue[title]"
|
16
16
|
assert_select "select#issue_status[name=?]", "issue[status]"
|
17
17
|
assert_select "select#issue_creator_id[name=?]", "issue[creator_id]"
|
18
|
+
assert_select "select#issue_assignee_id[name=?]", "issue[assignee_id]"
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -17,5 +17,6 @@ RSpec.describe "issues/index", type: :view do
|
|
17
17
|
assert_select "tr>td", :text => 'issue2', :count => 1
|
18
18
|
assert_select "tr>td", :text => 'Draft', :count => 2
|
19
19
|
assert_select "tr>td", :text => 'user1@example.com', :count => 2
|
20
|
+
assert_select "tr>td", :text => 'user1@example.com', :count => 2
|
20
21
|
end
|
21
22
|
end
|
@@ -15,6 +15,7 @@ RSpec.describe "issues/new", type: :view do
|
|
15
15
|
assert_select "input#issue_title[name=?]", "issue[title]"
|
16
16
|
assert_select "select#issue_status[name=?]", "issue[status]"
|
17
17
|
assert_select "select#issue_creator_id[name=?]", "issue[creator_id]"
|
18
|
+
assert_select "select#issue_assignee_id[name=?]", "issue[assignee_id]"
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "phases/edit", type: :view do
|
4
|
+
let(:project){ FactoryGirl.create(:project, owner: user) }
|
5
|
+
let(:user){ FactoryGirl.create(:user) }
|
6
|
+
before(:each) do
|
7
|
+
@phase = assign(:phase, FactoryGirl.create(:phase, project: project))
|
8
|
+
end
|
9
|
+
|
10
|
+
it "renders the edit phase form" do
|
11
|
+
render
|
12
|
+
|
13
|
+
assert_select "form[action=?][method=?]", phase_path(@phase), "post" do
|
14
|
+
assert_select "select#phase_project_id[name=?]", "phase[project_id]"
|
15
|
+
assert_select "input#phase_name[name=?]", "phase[name]"
|
16
|
+
assert_select_datetime_field :phase, :started_at
|
17
|
+
assert_select_datetime_field :phase, :finished_at
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "phases/index", type: :view do
|
4
|
+
let(:project){ FactoryGirl.create(:project, owner: user) }
|
5
|
+
let(:user){ FactoryGirl.create(:user) }
|
6
|
+
before(:each) do
|
7
|
+
assign(:phases, [
|
8
|
+
FactoryGirl.create(:phase, name: 'phase1', project: project),
|
9
|
+
FactoryGirl.create(:phase, name: 'phase2', project: project),
|
10
|
+
])
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders a list of phases" do
|
14
|
+
render
|
15
|
+
assert_select "tr>td", :text => 'project1', :count => 2
|
16
|
+
assert_select "tr>td", :text => 'phase1', :count => 1
|
17
|
+
assert_select "tr>td", :text => 'phase2', :count => 1
|
18
|
+
assert_select "tr>td", :text => localize(Time.zone.parse('2020-01-29 02:50:00 +09:00')), :count => 2
|
19
|
+
assert_select "tr>td", :text => localize(Time.zone.parse('2020-01-29 16:40:00 +09:00')), :count => 2
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "phases/new", type: :view do
|
4
|
+
let(:project){ FactoryGirl.create(:project, owner: user) }
|
5
|
+
let(:user){ FactoryGirl.create(:user) }
|
6
|
+
before(:each) do
|
7
|
+
assign(:phase, FactoryGirl.build(:phase, project: project))
|
8
|
+
end
|
9
|
+
|
10
|
+
it "renders new phase form" do
|
11
|
+
render
|
12
|
+
|
13
|
+
assert_select "form[action=?][method=?]", phases_path, "post" do
|
14
|
+
assert_select "select#phase_project_id[name=?]", "phase[project_id]"
|
15
|
+
assert_select "input#phase_name[name=?]", "phase[name]"
|
16
|
+
assert_select_datetime_field :phase, :started_at
|
17
|
+
assert_select_datetime_field :phase, :finished_at
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "phases/show", type: :view do
|
4
|
+
let(:project){ FactoryGirl.create(:project, owner: user) }
|
5
|
+
let(:user){ FactoryGirl.create(:user) }
|
6
|
+
before(:each) do
|
7
|
+
@phase = assign(:phase, FactoryGirl.create(:phase, project: project))
|
8
|
+
end
|
9
|
+
|
10
|
+
it "renders attributes in <p>" do
|
11
|
+
render
|
12
|
+
expect(rendered).to match(/project1/)
|
13
|
+
expect(rendered).to match(/phase1/)
|
14
|
+
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-01-29 02:50:00 +09:00')))))
|
15
|
+
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-01-29 16:40:00 +09:00')))))
|
16
|
+
end
|
17
|
+
end
|
@@ -14,7 +14,7 @@ RSpec.describe "project_assignments/index", type: :view do
|
|
14
14
|
render
|
15
15
|
assert_select "tr>td", :text => 'project1', :count => 2
|
16
16
|
assert_select "tr>td", :text => 'user1@example.com', :count => 2
|
17
|
-
assert_select "tr>td", :text => localize(Time.zone.parse('2020-03-22 09:50:00')), :count => 2
|
18
|
-
assert_select "tr>td", :text => localize(Time.zone.parse('2020-03-22 23:40:00')), :count => 2
|
17
|
+
assert_select "tr>td", :text => localize(Time.zone.parse('2020-03-22 09:50:00 +09:00')), :count => 2
|
18
|
+
assert_select "tr>td", :text => localize(Time.zone.parse('2020-03-22 23:40:00 +09:00')), :count => 2
|
19
19
|
end
|
20
20
|
end
|
@@ -11,7 +11,7 @@ RSpec.describe "project_assignments/show", type: :view do
|
|
11
11
|
render
|
12
12
|
expect(rendered).to match(/project1/)
|
13
13
|
expect(rendered).to match(/user1@example.com/)
|
14
|
-
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-03-22 09:50:00')))))
|
15
|
-
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-03-22 23:40:00')))))
|
14
|
+
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-03-22 09:50:00 +09:00')))))
|
15
|
+
expect(rendered).to match(Regexp.new(Regexp.escape(localize(Time.zone.parse('2020-03-22 23:40:00 +09:00')))))
|
16
16
|
end
|
17
17
|
end
|
@@ -83,7 +83,7 @@ module ModelBase
|
|
83
83
|
when :integer then idx
|
84
84
|
when :float then idx + 0.5
|
85
85
|
when :decimal then "#{idx}.99"
|
86
|
-
when :datetime, :timestamp, :time then sample_time(idx).
|
86
|
+
when :datetime, :timestamp, :time then sample_time(idx).strftime('%F %T %:z')
|
87
87
|
when :date then sample_time(idx).to_date.to_s(:db)
|
88
88
|
when :string then
|
89
89
|
case name
|
@@ -156,8 +156,8 @@ module ModelBase
|
|
156
156
|
def render(form_name, target_name, options = {})
|
157
157
|
html = options.delete(:html) || {}
|
158
158
|
html_exp = html.empty? ? nil : html.inspect.gsub(/\A\{|\}\z/, '')
|
159
|
-
options.update(include_blank: !column_attr.required?
|
160
|
-
options_exp = {}.inspect
|
159
|
+
options.update(include_blank: true) if !column_attr.required?
|
160
|
+
options_exp = '{%s}' % options.map{|k,v| "#{k}: #{v.inspect}"}.join(', ')
|
161
161
|
r = render_core(form_name, target_name)
|
162
162
|
r << ", #{options_exp}"
|
163
163
|
r << ", #{html_exp}" unless html.empty?
|
data/lib/model_base/version.rb
CHANGED
@@ -15,7 +15,11 @@
|
|
15
15
|
<%- if column.linkable? -%>
|
16
16
|
<td><%%= link_to <%= model.full_resource_name %>.<%= column.name %>, <%= singular_controller_routing_path %>_path(<%= model.full_resource_name %>) %></td>
|
17
17
|
<%- elsif tcol = column.ref_model.try(:title_column) -%>
|
18
|
+
<%- if column.required? -%>
|
18
19
|
<td><%%= <%= model.full_resource_name %>.<%= column.reference.name %>.<%= tcol.name %> %></td>
|
20
|
+
<%- else -%>
|
21
|
+
<td><%%= <%= model.full_resource_name %>.<%= column.reference.name %>.try(:<%= tcol.name %>) %></td>
|
22
|
+
<%- end -%>
|
19
23
|
<%- elsif column.enumerized? -%>
|
20
24
|
<td><%%= <%= model.full_resource_name %>.<%= column.name %>_text %></td>
|
21
25
|
<%- elsif column.to_be_localized? -%>
|
@@ -7,7 +7,11 @@
|
|
7
7
|
<%- model.columns_for(:show).each do |column| -%>
|
8
8
|
<dt><strong><%%= model_class.human_attribute_name(:<%= column.name %>) %>:</strong></dt>
|
9
9
|
<%- if tcol = column.ref_model.try(:title_column) -%>
|
10
|
+
<%- if column.required? -%>
|
10
11
|
<dd><%%= @<%= model.full_resource_name %>.<%= column.reference.name %>.<%= tcol.name %> %></dd>
|
12
|
+
<%- else -%>
|
13
|
+
<dd><%%= @<%= model.full_resource_name %>.<%= column.reference.name %>.try(:<%= tcol.name %>) %></dd>
|
14
|
+
<%- end -%>
|
11
15
|
<%- elsif column.enumerized? -%>
|
12
16
|
<dd><%%= @<%= model.full_resource_name %>.<%= column.name %>_text %></dd>
|
13
17
|
<%- elsif column.to_be_localized? -%>
|
@@ -2,7 +2,11 @@ FactoryGirl.define do
|
|
2
2
|
factory :<%= model.full_resource_name %> do
|
3
3
|
<%- model.columns_for(:factory).each do |col| -%>
|
4
4
|
<%- if col.reference -%>
|
5
|
+
<%- if col.required? -%>
|
5
6
|
association :<%= col.reference.name %>, factory: :<%= col.ref_model.full_resource_name %>
|
7
|
+
<%- else -%>
|
8
|
+
<%= col.reference.name %> nil
|
9
|
+
<%- end -%>
|
6
10
|
<%- else -%>
|
7
11
|
<%= col.name %> <%= col.sample_value(context: :factory).inspect %>
|
8
12
|
<%- end -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_base_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -142,10 +142,12 @@ files:
|
|
142
142
|
- example/app/controllers/concerns/.keep
|
143
143
|
- example/app/controllers/concerns/authentication.rb
|
144
144
|
- example/app/controllers/issues_controller.rb
|
145
|
+
- example/app/controllers/phases_controller.rb
|
145
146
|
- example/app/controllers/project_assignments_controller.rb
|
146
147
|
- example/app/controllers/projects_controller.rb
|
147
148
|
- example/app/helpers/application_helper.rb
|
148
149
|
- example/app/helpers/issues_helper.rb
|
150
|
+
- example/app/helpers/phases_helper.rb
|
149
151
|
- example/app/helpers/projects_helper.rb
|
150
152
|
- example/app/jobs/application_job.rb
|
151
153
|
- example/app/mailers/application_mailer.rb
|
@@ -153,11 +155,13 @@ files:
|
|
153
155
|
- example/app/models/application_record.rb
|
154
156
|
- example/app/models/concerns/.keep
|
155
157
|
- example/app/models/issue.rb
|
158
|
+
- example/app/models/phase.rb
|
156
159
|
- example/app/models/project.rb
|
157
160
|
- example/app/models/project_assignment.rb
|
158
161
|
- example/app/models/user.rb
|
159
162
|
- example/app/validations/ar_internal_metadatum_validation.rb
|
160
163
|
- example/app/validations/issue_validation.rb
|
164
|
+
- example/app/validations/phase_validation.rb
|
161
165
|
- example/app/validations/project_assignment_validation.rb
|
162
166
|
- example/app/validations/project_validation.rb
|
163
167
|
- example/app/validations/user_validation.rb
|
@@ -170,6 +174,12 @@ files:
|
|
170
174
|
- example/app/views/layouts/application.html.erb
|
171
175
|
- example/app/views/layouts/mailer.html.erb
|
172
176
|
- example/app/views/layouts/mailer.text.erb
|
177
|
+
- example/app/views/phases/_form.html.erb
|
178
|
+
- example/app/views/phases/_table.html.erb
|
179
|
+
- example/app/views/phases/edit.html.erb
|
180
|
+
- example/app/views/phases/index.html.erb
|
181
|
+
- example/app/views/phases/new.html.erb
|
182
|
+
- example/app/views/phases/show.html.erb
|
173
183
|
- example/app/views/project_assignments/_form.html.erb
|
174
184
|
- example/app/views/project_assignments/_table.html.erb
|
175
185
|
- example/app/views/project_assignments/edit.html.erb
|
@@ -209,7 +219,9 @@ files:
|
|
209
219
|
- example/config/initializers/session_store.rb
|
210
220
|
- example/config/initializers/wrap_parameters.rb
|
211
221
|
- example/config/locales/devise.en.yml
|
222
|
+
- example/config/locales/devise.ja.yml
|
212
223
|
- example/config/locales/en.yml
|
224
|
+
- example/config/locales/rails.ja.yml
|
213
225
|
- example/config/puma.rb
|
214
226
|
- example/config/routes.rb
|
215
227
|
- example/config/secrets.yml
|
@@ -224,14 +236,17 @@ files:
|
|
224
236
|
- example/public/apple-touch-icon.png
|
225
237
|
- example/public/favicon.ico
|
226
238
|
- example/spec/controllers/issues_controller_spec.rb
|
239
|
+
- example/spec/controllers/phases_controller_spec.rb
|
227
240
|
- example/spec/controllers/project_assignments_controller_spec.rb
|
228
241
|
- example/spec/controllers/projects_controller_spec.rb
|
229
242
|
- example/spec/factories/issues.rb
|
243
|
+
- example/spec/factories/phases.rb
|
230
244
|
- example/spec/factories/project_assignments.rb
|
231
245
|
- example/spec/factories/projects.rb
|
232
246
|
- example/spec/factories/users.rb
|
233
247
|
- example/spec/rails_helper.rb
|
234
248
|
- example/spec/routing/issues_routing_spec.rb
|
249
|
+
- example/spec/routing/phases_routing_spec.rb
|
235
250
|
- example/spec/routing/project_assignments_routing_spec.rb
|
236
251
|
- example/spec/routing/projects_routing_spec.rb
|
237
252
|
- example/spec/spec_helper.rb
|
@@ -242,6 +257,10 @@ files:
|
|
242
257
|
- example/spec/views/issues/index.html.erb_spec.rb
|
243
258
|
- example/spec/views/issues/new.html.erb_spec.rb
|
244
259
|
- example/spec/views/issues/show.html.erb_spec.rb
|
260
|
+
- example/spec/views/phases/edit.html.erb_spec.rb
|
261
|
+
- example/spec/views/phases/index.html.erb_spec.rb
|
262
|
+
- example/spec/views/phases/new.html.erb_spec.rb
|
263
|
+
- example/spec/views/phases/show.html.erb_spec.rb
|
245
264
|
- example/spec/views/project_assignments/edit.html.erb_spec.rb
|
246
265
|
- example/spec/views/project_assignments/index.html.erb_spec.rb
|
247
266
|
- example/spec/views/project_assignments/new.html.erb_spec.rb
|