diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-05-23 15:01:17 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-05-23 15:01:17 -0400 |
commit | dc4ace8ba7989c827b0d8c4f92f0e5256d695796 (patch) | |
tree | e429048afac8a98210f8712abe999cee7c278d4b /src/guff.cr | |
parent | d54f952db59093b4a08bedae10258badbe915283 (diff) | |
download | guff-dc4ace8ba7989c827b0d8c4f92f0e5256d695796.tar.bz2 guff-dc4ace8ba7989c827b0d8c4f92f0e5256d695796.zip |
simplify state buttons
Diffstat (limited to 'src/guff.cr')
-rw-r--r-- | src/guff.cr | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/guff.cr b/src/guff.cr index 8228e88..01e0cb4 100644 --- a/src/guff.cr +++ b/src/guff.cr @@ -1447,6 +1447,17 @@ module Guff </li> </ul> ", + + state_button: " + <a + href='#' + class='btn %s post-state' + title='Mark as %s.' + > + <i class='fa %s'></i> + %s + </a> + ", } def tabs(id : String) @@ -1465,6 +1476,36 @@ module Guff end end + STATES = [{ + id: "draft", + name: "Draft", + icon: "fa-wrench", + css: "btn-primary", + }, { + id: "posted", + name: "Posted", + icon: "fa-bullhorn", + css: "btn-default", + }, { + id: "deleted", + name: "Deleted", + icon: "fa-trash", + css: "btn-default", + }] + + private def state_buttons + @state_buttons ||= String.build do |io| + STATES.each do |row| + io << TEMPLATES[:state_button] % [ + h(row[:css]), + h(row[:name]), + h(row[:icon]), + h(row[:name]) + ] + end + end + end + ECR.def_to_s("src/views/admin-page.ecr") end |