Created
July 2, 2016 07:21
-
-
Save konung/112bb3439206b422f913211aafeb5c28 to your computer and use it in GitHub Desktop.
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
class ApplicationController < ActionController::Base | |
include Trailblazer::Operation::Controller | |
respond_to :html, :json, :xml | |
#.... | |
end | |
# app/concepts/layout/cell.rb | |
class Layout::Cell < Cell::App | |
def show | |
render | |
end | |
def head | |
render :head | |
end | |
def javascripts | |
render :javascripts | |
end | |
def stylesheets | |
render :stylesheets | |
end | |
def header | |
render :header | |
end | |
def flash | |
render :flash | |
end | |
def page_title | |
render :page_title | |
end | |
def breadcrumbs | |
render :breadcrumbs | |
end | |
def footer | |
render :footer | |
end | |
def sidebar_user_panel | |
render :sidebar_user_panel | |
end | |
# .... etc | |
end | |
# app\views\layouts\application.haml | |
# !!! | |
%html{lang: 'en'} | |
- @js = javascript_include_tag 'application' | |
- @sh = stylesheet_link_tag 'application' | |
= concept('layout/cell', nil, javascript: @js, stylesheet: @sh ).(:head) | |
= yield :javascripts | |
%body.sidebar-mini.skin-black-light.sidebar-collapse{class: "#{ controller.controller_name }" } | |
.wrapper | |
= concept('layout/cell', @user_session).(:header) | |
= concept('layout/cell', nil).(:sidebar_left) | |
%article.content-wrapper | |
/ Content Header (Page header) | |
%section.content-header | |
.row | |
.col-sm-12 | |
.page-title.pull-left | |
= concept('layout/cell', nil).(:page_title) | |
.text-right.pull-right | |
= concept('layout/cell', nil).(:breadcrumbs) | |
= concept('layout/cell', nil, flash: flash.to_hash).(:flash) | |
/ Main content | |
%section.content | |
.row | |
.col-sm-12 | |
= yield | |
= concept('layout/cell', nil, generated_in: (Time.now - @start_time)).(:footer) | |
= concept('layout/cell', nil).(:sidebar_right) | |
= concept('layout/cell', nil).(:back_to_top) | |
/ Control Sidebar | |
# app/controllers\rates_controller.rb | |
class RatesController < ApplicationController | |
include React::Rails::ViewHelper | |
def index | |
present Rate::Search | |
#redirect_to action: :new and return if @model.empty? | |
respond_with @operation do |format| | |
format.html{ concept('rate/cell/react', @operation)} | |
format.json{ Rate::Representer::Json::Collection} | |
format.xml{ Rate::Representer::Xml::Collection} | |
end | |
end | |
# ... | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment