-
Notifications
You must be signed in to change notification settings - Fork 5
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
23 changed files
with
516 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.slug { | ||
-webkit-box-flex: 0; | ||
display: flex; | ||
} | ||
|
||
.slug .url { | ||
width: 60%; | ||
overflow: scroll; | ||
border: 1px solid #ccc; | ||
background: #fafafa; | ||
border-right: 0; | ||
border-radius: 4px 0 0 4px; | ||
} | ||
|
||
.slug .url span { | ||
color: #666; | ||
display: inline-block; | ||
font-size: 13px; | ||
padding: 6px 4px 0 4px; | ||
} | ||
|
||
.slug .slug-body { | ||
width: 40%; | ||
} | ||
|
||
.slug .slug-body input{ | ||
border-radius: 0 4px 4px 0; | ||
} |
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,61 @@ | ||
require_dependency 'comable/admin/application_controller' | ||
|
||
module Comable | ||
module Admin | ||
class PagesController < Comable::Admin::ApplicationController | ||
load_and_authorize_resource class: Comable::Page.name, except: :index | ||
|
||
def index | ||
@q = Comable::Page.ransack(params[:q]) | ||
@pages = @q.result(distinct: true).page(params[:page]).accessible_by(current_ability) | ||
end | ||
|
||
def show | ||
render :edit | ||
end | ||
|
||
def new | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def create | ||
@page = Comable::Page.new(page_params) | ||
|
||
if @page.save | ||
redirect_to comable.admin_page_path(@page), notice: Comable.t('successful') | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
def update | ||
if @page.update_attributes(page_params) | ||
redirect_to comable.admin_page_path(@page), notice: Comable.t('successful') | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
@page.destroy | ||
redirect_to admin_pages_url, notice: Comable.t('successful') | ||
end | ||
|
||
private | ||
|
||
def page_params | ||
params.require(:page).permit( | ||
:title, # コンテンツのタイトル | ||
:content, # コンテンツ | ||
:page_title, # ページのタイトル | ||
:meta_description, # ディスクリプション | ||
:meta_keywords, # キーワード | ||
:slug, # スラグ | ||
:published_at # 公開日時 | ||
) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Comable | ||
module Admin | ||
module PagesHelper | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
= error_messages_for @page | ||
|
||
- url = @page.new_record? ? comable.admin_pages_path : comable.admin_page_path(@page) | ||
|
||
= form_for @page, url: url, html: { multipart: true } do |f| | ||
.hidden | ||
= f.submit | ||
|
||
fieldset | ||
.col-md-3 | ||
legend | ||
= Comable.t('admin.nav.pages.general') | ||
|
||
.col-md-9 | ||
.form-group | ||
= f.label :title | ||
= f.text_field :title | ||
|
||
.form-group | ||
= f.label :content | ||
= f.text_area :content | ||
|
||
hr | ||
|
||
fieldset | ||
.col-md-3 | ||
legend | ||
= Comable.t('admin.nav.pages.seo') | ||
|
||
.col-md-9 | ||
.form-group | ||
= f.label :page_title | ||
= f.text_field :page_title | ||
|
||
.form-group | ||
= f.label :meta_description | ||
= f.text_field :meta_description | ||
|
||
.form-group | ||
= f.label :meta_keywords | ||
= f.text_field :meta_keywords | ||
|
||
.form-group | ||
= f.label :slug | ||
.slug | ||
.url | ||
span= comable.admin_pages_url + '/' | ||
.slug-body | ||
= f.text_field :slug | ||
|
||
hr | ||
|
||
fieldset | ||
.col-md-3 | ||
legend | ||
= Comable.t('admin.nav.pages.visibility') | ||
|
||
.col-md-9 | ||
.form-group | ||
= f.label :published_at | ||
= f.text_field :published_at, value: @page.published_at.try(:strftime,'%Y-%m-%d %H:%m'), class: 'datetimepicker' |
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,36 @@ | ||
.comable-page | ||
.comable-main-fixed-top | ||
.comable-page-heading | ||
ul.pull-right.list-inline | ||
li.dropdown | ||
= link_to '#', class: 'btn btn-default', 'data-toggle' => 'dropdown' do | ||
i.fa.fa-bars | ||
ul.dropdown-menu.dropdown-menu-right | ||
li | ||
= link_to comable.admin_page_path(@page) do | ||
span.fa.fa-external-link> | ||
= Comable.t('admin.preview') | ||
|
||
li | ||
= link_to_save | ||
|
||
h1.page-header | ||
ol.breadcrumb | ||
li> | ||
= link_to Comable.t('admin.nav.page'), comable.admin_pages_path | ||
li.active | ||
= @page.title | ||
|
||
.comable-page-body | ||
= render 'form' | ||
hr | ||
.panel.panel-danger | ||
.panel-heading type="button" data-toggle="collapse" data-target="#comable-danger" | ||
strong | ||
span.fa.fa-angle-down> | ||
= Comable.t('admin.actions.destroy') | ||
#comable-danger.collapse | ||
.panel-body | ||
p | ||
= Comable.t('admin.confirmation_to_remove_page') | ||
= link_to Comable.t('admin.actions.destroy'), comable.admin_page_path(@page), method: :delete, class: 'btn btn-danger' |
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,47 @@ | ||
.comable-page | ||
.comable-page-heading | ||
ul.pull-right.list-inline | ||
li | ||
= link_to comable.root_path do | ||
= link_to Comable.t('admin.actions.new'), comable.new_admin_page_path, class: 'btn btn-default' | ||
h1.page-header | ||
= Comable.t('admin.nav.page') | ||
small< | ||
| #{@pages.total_count} #{Comable.t('admin.results')} | ||
|
||
.comable-page-body | ||
.comable-search | ||
= search_form_for @q, url: comable.admin_pages_path do |f| | ||
.input-group | ||
span.input-group-btn | ||
button.btn.btn-default.dropdown-toggle type="button" data-toggle="dropdown" | ||
i.fa.fa-search | ||
span.caret< | ||
ul.dropdown-menu role="menu" | ||
li | ||
= link_to Comable.t('admin.advanced_search'), 'javascript:void(0)', 'data-toggle' => 'collapse', 'data-target' => '#comable-advanced-search' | ||
li | ||
= link_to Comable.t('admin.clear_search_conditions'), comable.admin_pages_path | ||
= f.text_field :title_cont, class: 'form-control' | ||
span.input-group-btn | ||
= f.submit Comable.t('admin.search'), class: 'btn btn-default' | ||
|
||
= render 'comable/admin/shared/advanced_search', f: f | ||
|
||
section | ||
- if @pages.empty? | ||
= Comable.t('admin.not_found') | ||
- else | ||
table.table.table-striped | ||
thead | ||
th | ||
= sort_link [:comable, @q], :id | ||
th | ||
= sort_link [:comable, @q], :title | ||
tbody | ||
- @pages.each do |page| | ||
tr | ||
td | ||
= page.id | ||
td | ||
= link_to page.title, comable.admin_page_path(page) |
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,16 @@ | ||
.comable-page | ||
.comable-main-fixed-top | ||
.comable-page-heading | ||
ul.pull-right.list-inline | ||
li | ||
= link_to_save | ||
|
||
h1.page-header | ||
ol.breadcrumb | ||
li> | ||
= link_to Comable.t('admin.nav.page'), comable.admin_products_path | ||
li.active | ||
= Comable.t('admin.actions.new') | ||
|
||
.comable-page-body | ||
= render 'form' |
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
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
Oops, something went wrong.