summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/application.scss15
-rw-r--r--app/assets/stylesheets/leap.scss65
-rw-r--r--app/helpers/application_helper.rb17
-rw-r--r--app/helpers/navigation_helper.rb82
-rw-r--r--app/views/home/_home_text.html.haml3
-rw-r--r--app/views/home/index.html.haml23
-rw-r--r--app/views/layouts/_footer.html.haml0
-rw-r--r--app/views/layouts/_header.html.haml3
-rw-r--r--app/views/layouts/_masthead.html.haml4
-rw-r--r--app/views/layouts/_masthead_large.html.haml3
-rw-r--r--app/views/layouts/_navigation.html.haml17
-rw-r--r--app/views/layouts/application.html.haml30
-rw-r--r--config/defaults.yml4
-rw-r--r--config/locales/en.yml7
14 files changed, 238 insertions, 35 deletions
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 25e854e..5a5e900 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -1,7 +1,7 @@
//
// import custom scss, content to be set in deployment.
//
-@import "tail";
+@import "head";
// First import journal variables
@import "bootswatch/cerulean/variables";
@@ -10,17 +10,12 @@
// import bootstrap.
//
@import "bootstrap";
-body { padding-top: 60px; }
-
@import "bootstrap-responsive";
-table.table-hover .btn {
- opacity: 0;
-}
-table.table-hover tr:hover .btn {
- opacity: 1;
-}
-@import "bootstrap-editable";
+//
+// LEAP web app specific overrides
+//
+@import "leap";
// And finally bootswatch style itself
@import "bootswatch/cerulean/bootswatch";
diff --git a/app/assets/stylesheets/leap.scss b/app/assets/stylesheets/leap.scss
new file mode 100644
index 0000000..42638eb
--- /dev/null
+++ b/app/assets/stylesheets/leap.scss
@@ -0,0 +1,65 @@
+
+table.table-hover .btn {
+ opacity: 0;
+}
+table.table-hover tr:hover .btn {
+ opacity: 1;
+}
+
+.debug {
+ outline: 1px solid red;
+}
+
+//
+// Icons
+//
+
+
+// force a black icon, even if bootstrap thinks differently
+.icon-black {
+ background-image: url(/assets/glyphicons-halflings.png) !important;
+}
+
+//
+// Typography
+//
+
+.first {
+ margin-top: 0;
+ padding-top: 0;
+}
+
+//
+// Boring default masthead
+//
+
+#masthead {
+ background: #eee;
+ margin-bottom: 10px;
+ border-bottom: 1px solid #e6e6e6;
+ .title {
+ padding: 20px;
+ font-size: 1.25em;
+ }
+ .sitename {
+ font-weight: bold;
+ }
+}
+
+//
+// Side Navigation
+//
+
+.sidenav {
+ @extend .nav-tabs;
+ @extend .nav-stacked;
+ box-shadow: 0 2px 4px rgba(0,0,0,.1);
+ li.active {
+ a, a:hover {
+ background-color: $blueDark;
+ color: $white;
+ border-color: darken($blueDark, 10%);
+ cursor: pointer;
+ }
+ }
+}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index de6be79..db70109 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,2 +1,19 @@
module ApplicationHelper
+
+ #
+ # markup for bootstrap icon
+ #
+ # http://twitter.github.io/bootstrap/base-css.html#icons
+ #
+ def icon(name, color=nil)
+ if color.nil?
+ color_class = nil
+ elsif color == :black
+ color_class = 'icon-black'
+ elsif color == :white
+ color_class = 'icon-white'
+ end
+ "<i class=\"icon-#{name} #{color_class}\"></i> ".html_safe
+ end
+
end
diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb
new file mode 100644
index 0000000..19cb934
--- /dev/null
+++ b/app/helpers/navigation_helper.rb
@@ -0,0 +1,82 @@
+module NavigationHelper
+
+ #
+ # used to create a side navigation link.
+ #
+ # Signature is the same as link_to, except it accepts an :active value in the html_options
+ #
+ def link_to_navigation(*args)
+ if args.last.is_a? Hash
+ html_options = args.pop.dup
+ active_class = html_options.delete(:active) ? 'active' : nil
+ html_options[:class] = [html_options[:class], active_class].join(' ')
+ args << html_options
+ else
+ active_class = nil
+ end
+ content_tag :li, :class => active_class do
+ link_to(*args)
+ end
+ end
+
+ #
+ # returns true if params[:action] matches one of the args.
+ #
+ def action?(*actions)
+ actions.detect do |action|
+ if action.is_a? String
+ action == action_string
+ elsif action.is_a? Symbol
+ if action == :none
+ action_string == nil
+ else
+ action == action_symbol
+ end
+ end
+ end
+ end
+
+ #
+ # returns true if params[:controller] matches one of the args.
+ #
+ # for example:
+ # controller?(:me, :home)
+ # controller?('groups/') <-- matches any controller in namespace 'groups'
+ #
+ def controller?(*controllers)
+ controllers.each do |cntr|
+ if cntr.is_a? String
+ if cntr.ends_with?('/')
+ return true if controller_string.starts_with?(cntr.chop)
+ end
+ return true if cntr == controller_string
+ elsif cntr.is_a? Symbol
+ return true if cntr == controller_symbol
+ end
+ end
+ return false
+ end
+
+ private
+
+ def controller_string
+ @controller_string ||= params[:controller].to_s.gsub(/^\//, '')
+ end
+
+ def controller_symbol
+ @controller_symbol ||= params[:controller].gsub(/^\//,'').gsub('/','_').to_sym
+ end
+
+ def action_string
+ params[:action]
+ end
+
+ def action_symbol
+ @action_symbol ||= if params[:action].present?
+ params[:action].to_sym
+ else
+ nil
+ end
+ end
+
+end
diff --git a/app/views/home/_home_text.html.haml b/app/views/home/_home_text.html.haml
new file mode 100644
index 0000000..1055091
--- /dev/null
+++ b/app/views/home/_home_text.html.haml
@@ -0,0 +1,3 @@
+Welcome to the LEAP web application.
+
+For more information, visit #{link_to('leap.se', 'https://leap.se')} \ No newline at end of file
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index c02dcad..0b3bbf9 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -1,11 +1,16 @@
-Try to fetch a
-= link_to "cert", cert_path
+.row-fluid
+ .span8
+ = render 'home_text'
+ .span4
+ = render '/login_or_signup'
-%p
-Create a
-= link_to "ticket", new_ticket_path
+- if Rails.env == 'development'
+ .row-fluid
+ %hr
+ %p
+ Try to fetch a
+ = link_to "cert", cert_path
-- if logged_in?
- %p
- See all
- = link_to "tickets", tickets_path
+ %p
+ Create a
+ = link_to "ticket", new_ticket_path
diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/views/layouts/_footer.html.haml
diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml
new file mode 100644
index 0000000..aa4054b
--- /dev/null
+++ b/app/views/layouts/_header.html.haml
@@ -0,0 +1,3 @@
+- if user
+ %strong.user_address
+ = user.email_address
diff --git a/app/views/layouts/_masthead.html.haml b/app/views/layouts/_masthead.html.haml
new file mode 100644
index 0000000..280f2c2
--- /dev/null
+++ b/app/views/layouts/_masthead.html.haml
@@ -0,0 +1,4 @@
+.title
+ %span.sitename
+ = APP_CONFIG[:domain]
+ = t(:user_control_panel) \ No newline at end of file
diff --git a/app/views/layouts/_masthead_large.html.haml b/app/views/layouts/_masthead_large.html.haml
new file mode 100644
index 0000000..6bb1943
--- /dev/null
+++ b/app/views/layouts/_masthead_large.html.haml
@@ -0,0 +1,3 @@
+.title
+ %span.sitename
+ = APP_CONFIG[:domain] \ No newline at end of file
diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml
index b75eed7..7cd0f38 100644
--- a/app/views/layouts/_navigation.html.haml
+++ b/app/views/layouts/_navigation.html.haml
@@ -1,6 +1,13 @@
-= link_to "Leap Web", root_path, :class => 'brand'
-%ul.nav
- // = render '/tickets/nav'
+//= link_to "Leap Web", root_path, :class => 'brand'
+//%ul.nav
+// // = render '/tickets/nav'
+//
+//%ul.nav.pull-right
+// = render '/sessions/nav'
-%ul.nav.pull-right
- = render '/sessions/nav'
+%ul.nav.sidenav
+ = link_to_navigation t(:overview), user_overview_path(user), :active => controller?(:overviews)
+ = link_to_navigation t(:account_settings), edit_user_path(user), :active => controller?(:users)
+ =# link_to_navigation t(:email_settings), edit_email_path(user), :active => controller?(:emails)
+ = link_to_navigation t(:support_tickets), tickets_path, :active => controller?(:tickets)
+ = link_to_navigation t(:logout), logout_path, :method => :delete
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index e6d22f0..719d699 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -9,15 +9,27 @@
= csrf_meta_tags
= yield(:head)
%body
- %header.navbar.navbar-fixed-top
- %nav.navbar-inner
- .container
- = render 'layouts/navigation'
- #main{:role => "main"}
- .container
- .content
- .row
+ #masthead
+ - if logged_in?
+ = render 'layouts/masthead'
+ - else
+ = render 'layouts/masthead_large'
+ #main
+ .container-fluid
+ - if logged_in?
+ .row-fluid
.span12
+ = render 'layouts/header'
+ .row-fluid
+ .span2
+ = render 'layouts/navigation'
+ .span10
= render 'layouts/messages'
= yield
- %footer
+ - else
+ .row-fluid
+ .span12
+ = render 'layouts/messages'
+ = yield
+ #footer
+ = render 'layouts/footer'
diff --git a/config/defaults.yml b/config/defaults.yml
index f3b92c0..25537fe 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -17,7 +17,7 @@ development:
<<: *dev_ca
<<: *cert_options
admins: [admin, admin2]
- domain: develop.me
+ domain: example.org
secret_token: '550df064dbc5052d9e192b324c1c5a1095c85a2195f88bd6f6829c63b74d8dffa4556494a2e8cc44345a1926be8b6cb17aa4b3f3102d826f5679c3fb57bb7100'
test:
@@ -30,4 +30,4 @@ test:
production:
<<: *cert_options
admins: []
- domain: deploy.me
+ domain: example.net
diff --git a/config/locales/en.yml b/config/locales/en.yml
index fc61c31..40cdb4a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -4,3 +4,10 @@
en:
hello: "Hello world"
no_such_thing: "No such %{thing}."
+
+ overview: "Overview"
+ user_control_panel: "user control panel"
+
+ created: "Created"
+ updated: "Updated"
+