Changes for mozo host

This commit is contained in:
2020-03-05 11:36:19 -05:00
parent 02e60c174d
commit 3aa204aa30
7 changed files with 32 additions and 17 deletions
@@ -2,6 +2,7 @@
#= require jquery_ujs
#= require foundation
#= require ace/ace
#= require moment
#= require ace/theme-monokai
#= require ace/mode-coffee
#= require ace/mode-handlebars
@@ -36,3 +37,6 @@ $ ->
iframe.attr 'src', url
$('#preview-modal').foundation('reveal', 'open')
false
$("[data-time]").each ->
$(this).text moment($(this).data("time")).format($(this).data("timeFormat") or "dd D MMM HH:mm")
+11 -8
View File
@@ -31,7 +31,7 @@ module Cmtool
# or normal text behaviour:
# - title "Home"
def title(*args)
content_for :title do
res = content_tag :h1, class: 'page-title' do
if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name))
model = args[1].respond_to?(:model_name) ? args[1] : args[1].class
if args.first == :index
@@ -40,11 +40,13 @@ module Cmtool
t("cmtool.action.#{args.first}.title", model: model.model_name.human)
end
else
raise 'Imporoper title declaration'
args.first
end
end
content_for :page_title, res
res
end
def are_you_sure(obj = nil)
if name = obj && obj.respond_to?(:name) && obj.name.presence
t('cmtool.general.are_you_sure_with_name', name: name, model: obj.class.model_name.human)
@@ -130,10 +132,10 @@ module Cmtool
controller.respond_to?(:cmtool_user) ? controller.send(:cmtool_user) :nil
end
def edit_td(obj)
path = case obj
def edit_td(obj, options = {})
path = options[:path] || case obj
when Array then edit_polymorphic_path(obj)
when SimplyStored::Couch then edit_polymorphic_path([cmtool, obj])
when SimplyStored::Couch then edit_polymorphic_path([options[:scope] || cmtool, obj])
else obj
end
content_tag(
@@ -143,12 +145,13 @@ module Cmtool
)
end
def destroy_td(obj)
path = case obj
def destroy_td(obj, options = {})
path = options[:path] || case obj
when Array then polymorphic_path(obj)
when SimplyStored::Couch then polymorphic_path([cmtool, obj])
when SimplyStored::Couch then polymorphic_path([options[:scope] || cmtool, obj])
else obj
end
content_tag(
:td,
link_to(content_tag(:span, '', class: [:destroy, 'fa fa-lg fa-trash']), path, method: :delete, class: 'tiny alert button', data: {confirm: are_you_sure(obj) }),
+2 -2
View File
@@ -1,12 +1,12 @@
- user = defined?(cmtool_user) ? cmtool_user : (defined?(current_user) ? current_user : nil)
.fixed
nav.top-bar data-topbar="" role="navigation"
nav.top-bar data-topbar="" role="navigation"
ul.title-area
li.name
h1
a href=cmtool.root_path = application_title
li.toggle-topbar.menu-icon
a href="#"
a href="#"
span Menu
section.top-bar-section
- if user.present?
@@ -6,8 +6,8 @@
th= Cmtool::NewsletterSubscription.human_attribute_name(:email)
th= Cmtool::NewsletterSubscription.human_attribute_name(:deactivation_token)
th= Cmtool::NewsletterSubscription.human_attribute_name(:active)
th
th
th.action-header
th.action-header
tbody
- @newsletter_subscriptions.each do |newsletter_subscription|
tr
@@ -39,6 +39,8 @@ html lang="en"
li= link_to 'Wiki', 'https://github.com/bterkuile/cmtool/wiki', target: :_blank
= yield :sidebar
footer
p © Cmtool 2015
p
span © Cmtool
span= Date.today.year
= yield :footer
#hidden-html.hide= yield :hidden_html