diff --git a/app/views/kuroko2/dashboard/index.html.slim b/app/views/kuroko2/dashboard/index.html.slim
index dd31d67a..d617eca1 100644
--- a/app/views/kuroko2/dashboard/index.html.slim
+++ b/app/views/kuroko2/dashboard/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Dashboard'
-- @content_title = ' Dashboard'
+- content_for :title, 'Dashboard'
+- content_for :content_title do
+ Dashboard
.row
.col-md-7
diff --git a/app/views/kuroko2/executions/index.html.slim b/app/views/kuroko2/executions/index.html.slim
index 20716031..8f498e56 100644
--- a/app/views/kuroko2/executions/index.html.slim
+++ b/app/views/kuroko2/executions/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Executions'
-- @content_title = ' Executions'
+- content_for :title, 'Executions'
+- content_for :content_title do
+ Executions
.box
.box-header
diff --git a/app/views/kuroko2/job_definition_stats/index.html.slim b/app/views/kuroko2/job_definition_stats/index.html.slim
index 40711d51..cf53ff64 100644
--- a/app/views/kuroko2/job_definition_stats/index.html.slim
+++ b/app/views/kuroko2/job_definition_stats/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Job Definition Stats'
-- @content_title = ' Job Definition Stats'
+- content_for :title, 'Job Definition Stats'
+- content_for :content_title do
+ Job Definition Stats
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/job_definitions/edit.html.slim b/app/views/kuroko2/job_definitions/edit.html.slim
index 4f8c1fd6..2263c71f 100644
--- a/app/views/kuroko2/job_definitions/edit.html.slim
+++ b/app/views/kuroko2/job_definitions/edit.html.slim
@@ -1,5 +1,5 @@
-- @title = "##{@definition.id} #{@definition.name} « Job Definitions"
-- @content_title = "##{@definition.id} #{@definition.name}"
+- content_for :title, "##{@definition.id} #{@definition.name} « Job Definitions"
+- content_for :content_title, "##{@definition.id} #{@definition.name}"
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/job_definitions/index.html.slim b/app/views/kuroko2/job_definitions/index.html.slim
index ee62bba1..c53566c9 100644
--- a/app/views/kuroko2/job_definitions/index.html.slim
+++ b/app/views/kuroko2/job_definitions/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Job Definitions'
-- @content_title = ' Job Definitions'
+- content_for :title, 'Job Definitions'
+- content_for :content_title do
+ Job Definitions
.row
.col-md-9
diff --git a/app/views/kuroko2/job_definitions/new.html.slim b/app/views/kuroko2/job_definitions/new.html.slim
index 215cfb55..fbc1fb2d 100644
--- a/app/views/kuroko2/job_definitions/new.html.slim
+++ b/app/views/kuroko2/job_definitions/new.html.slim
@@ -1,5 +1,6 @@
-- @title = 'New Job Definition'
-- @content_title = ' New Job Definition'
+- content_for :title, 'New Job Definition'
+- content_for :content_title do
+ New Job Definition
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/job_definitions/show.html.slim b/app/views/kuroko2/job_definitions/show.html.slim
index 5dc4ded5..9582bb24 100644
--- a/app/views/kuroko2/job_definitions/show.html.slim
+++ b/app/views/kuroko2/job_definitions/show.html.slim
@@ -1,5 +1,5 @@
-- @title = "##{@definition.id} #{@definition.name} « Job Definitions"
-- @content_title = "Job Definition Details"
+- content_for :title, "##{@definition.id} #{@definition.name} « Job Definitions"
+- content_for :content_title, "Job Definition Details"
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/job_instances/show.html.slim b/app/views/kuroko2/job_instances/show.html.slim
index b175d23e..e0b77fe9 100644
--- a/app/views/kuroko2/job_instances/show.html.slim
+++ b/app/views/kuroko2/job_instances/show.html.slim
@@ -1,5 +1,5 @@
-- @title = "##{@definition.id} #{@definition.name} « Jobs"
-- @content_title = "Job Instance Details"
+- content_for :title, "##{@definition.id} #{@definition.name} « Jobs"
+- content_for :content_title, "Job Instance Details"
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/job_instances/working.html.slim b/app/views/kuroko2/job_instances/working.html.slim
index a60b47c9..feb2ab1a 100644
--- a/app/views/kuroko2/job_instances/working.html.slim
+++ b/app/views/kuroko2/job_instances/working.html.slim
@@ -1,5 +1,6 @@
-- @title = "Working Jobs"
-- @content_title = ' Working Jobs'
+- content_for :title, "Working Jobs"
+- content_for :content_title do
+ Working Jobs
.box
.box-header
diff --git a/app/views/kuroko2/job_timelines/index.html.slim b/app/views/kuroko2/job_timelines/index.html.slim
index dce2be12..d8b0ac7b 100644
--- a/app/views/kuroko2/job_timelines/index.html.slim
+++ b/app/views/kuroko2/job_timelines/index.html.slim
@@ -1,6 +1,9 @@
-- @title = "Job Timelines"
-- @content_title = " #{@user.name}'s Job Timelines"
-- @content_title << " tagged by #{params[:tag].join(',')}" if params[:tag].present?
+- content_for :title, "Job Timelines"
+- content_for :content_title do
+ - if params[:tag].present?
+ #{@user.name}'s Job Timelines tagged by #{params[:tag].join(', ')}
+ - else
+ #{@user.name}'s Job Timelines
.row
.col-md-12
diff --git a/app/views/kuroko2/layouts/application.html.slim b/app/views/kuroko2/layouts/application.html.slim
index 99b8b208..cd1f33f0 100644
--- a/app/views/kuroko2/layouts/application.html.slim
+++ b/app/views/kuroko2/layouts/application.html.slim
@@ -1,11 +1,11 @@
doctype html
html
head
- title #{@title} « Kuroko 2
+ title #{yield(:title)} « Kuroko 2
meta charset='UTF-8'
meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'
link rel='icon' href='/favicon.ico'
- link type='application/opensearchdescription+xml' rel='search' href='#{osd_path(format: 'xml')}' title='Kuroko2'
+ link type='application/opensearchdescription+xml' rel='search' href='#{osd_path(format: 'xml')}' title='Kuroko2'
= csrf_meta_tag
= stylesheet_link_tag 'application'
= javascript_include_tag 'application'
@@ -59,7 +59,7 @@ html
aside.right-side
section.content-header
- h1= raw(@content_title || @title)
+ h1= yield(:content_title).presence || yield(:title)
= yield :breadcrumb
section.content
.container-fluid
diff --git a/app/views/kuroko2/sessions/invalid_hd.html.slim b/app/views/kuroko2/sessions/invalid_hd.html.slim
index f81d62eb..671ab66e 100644
--- a/app/views/kuroko2/sessions/invalid_hd.html.slim
+++ b/app/views/kuroko2/sessions/invalid_hd.html.slim
@@ -1,9 +1,9 @@
-- @title = 'Sign in failure'
+- content_for :title, 'Sign in failure'
doctype html
html.bg-black
head
- title #{@title} « Kuroko 2
+ title #{yield(:title)} « Kuroko 2
meta charset='UTF-8'
meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'
= stylesheet_link_tag 'kuroko2/application'
diff --git a/app/views/kuroko2/sessions/new.html.slim b/app/views/kuroko2/sessions/new.html.slim
index 27d7d2f3..5e710d6c 100644
--- a/app/views/kuroko2/sessions/new.html.slim
+++ b/app/views/kuroko2/sessions/new.html.slim
@@ -1,9 +1,9 @@
-- @title = 'Sign in'
+- content_for :title, 'Sign in'
doctype html
html.bg-black
head
- title #{@title} « Kuroko 2
+ title #{yield(:title)} « Kuroko 2
meta charset='UTF-8'
meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'
= stylesheet_link_tag 'kuroko2/application'
diff --git a/app/views/kuroko2/users/edit.html.slim b/app/views/kuroko2/users/edit.html.slim
index 841f80fc..729327d2 100644
--- a/app/views/kuroko2/users/edit.html.slim
+++ b/app/views/kuroko2/users/edit.html.slim
@@ -1,5 +1,5 @@
-- @title = "#{@user.name_was} « Users"
-- @content_title = "Edit User"
+- content_for :title, "#{@user.name_was} « Users"
+- content_for :content_title, 'Edit User'
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/users/index.html.slim b/app/views/kuroko2/users/index.html.slim
index 59178029..f1ea38f0 100644
--- a/app/views/kuroko2/users/index.html.slim
+++ b/app/views/kuroko2/users/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Users' + (params[:target] == 'group' ? ' > Groups' : '')
-- @content_title = " Users#{params[:target] == 'group' ? ' Groups' : ''}"
+- content_for :title, 'Users' + (params[:target] == 'group' ? ' > Groups' : '')
+- content_for :content_title do
+ Users#{params[:target] == 'group' ? ' Groups' : ''}
- @scope = @users
- if @user.errors.any?
diff --git a/app/views/kuroko2/users/show.html.slim b/app/views/kuroko2/users/show.html.slim
index 221751e0..ca88622c 100644
--- a/app/views/kuroko2/users/show.html.slim
+++ b/app/views/kuroko2/users/show.html.slim
@@ -1,5 +1,6 @@
-- @title = "#{@user.name} « Users"
-- @content_title = " User Details"
+- content_for :title, "#{@user.name} « Users"
+- content_for :content_title do
+ User Details
- content_for :breadcrumb do
ol.breadcrumb
diff --git a/app/views/kuroko2/workers/index.html.slim b/app/views/kuroko2/workers/index.html.slim
index 3cd65fc3..a6ae492e 100644
--- a/app/views/kuroko2/workers/index.html.slim
+++ b/app/views/kuroko2/workers/index.html.slim
@@ -1,5 +1,6 @@
-- @title = 'Kuroko Workers'
-- @content_title = ' Kuroko Workers'
+- content_for :title, 'Kuroko Workers'
+- content_for :content_title do
+ Kuroko Workers
.box#workers
.box-header
diff --git a/app/views/layouts/kuroko2/application.html.slim b/app/views/layouts/kuroko2/application.html.slim
index 15d2042e..df4b173c 100644
--- a/app/views/layouts/kuroko2/application.html.slim
+++ b/app/views/layouts/kuroko2/application.html.slim
@@ -1,7 +1,7 @@
doctype html
html
head
- title #{@title} « Kuroko 2
+ title #{yield(:title)} « Kuroko 2
meta charset='UTF-8'
meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'
link rel='icon' href='/favicon.ico'
@@ -63,7 +63,7 @@ html
aside.right-side
section.content-header
- h1= raw(@content_title || @title)
+ h1= yield(:content_title).presence || yield(:title)
= yield :breadcrumb
section.content
.container-fluid
diff --git a/spec/features/dashborad_spec.rb b/spec/features/dashborad_spec.rb
index 618a21fc..24de49e0 100644
--- a/spec/features/dashborad_spec.rb
+++ b/spec/features/dashborad_spec.rb
@@ -20,6 +20,9 @@
expect(page).to have_selector('#definitions_list table tbody tr', count: 1)
expect(page).to have_content('There are no working jobs.')
+ expect(page).to have_title('Dashboard « Kuroko 2')
+ expect(page).to have_selector('i.fa.fa-dashboard', text: '')
+ expect(page).to have_selector('h1', text: /Dashboard/)
end
context 'if the favorite job is working' do
diff --git a/spec/features/workers_spec.rb b/spec/features/workers_spec.rb
index b429d1cb..b3161113 100644
--- a/spec/features/workers_spec.rb
+++ b/spec/features/workers_spec.rb
@@ -24,6 +24,9 @@
visit kuroko2.workers_path
expect(page).to have_selector('#workers table tbody tr', count: 2)
expect(page).not_to have_content('echo Hello!')
+ expect(page).to have_title('Kuroko Workers « Kuroko 2')
+ expect(page).to have_selector('i.fa.fa-rocket', text: '')
+ have_selector('h1', text: /Kuroko Workers/)
worker.update_column(:execution_id, token.execution.id)