character 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/.rspec +1 -0
  4. data/README.md +185 -14
  5. data/Rakefile +8 -1
  6. data/app/assets/images/character/logo.jpg +0 -0
  7. data/app/assets/javascripts/character.coffee +134 -0
  8. data/app/assets/javascripts/character/dashboard/_visitors.coffee +27 -0
  9. data/app/assets/javascripts/character/dashboard/layout.coffee +156 -0
  10. data/app/assets/javascripts/character/dashboard/module.coffee +51 -0
  11. data/app/assets/javascripts/character/generic/details.coffee +233 -0
  12. data/app/assets/javascripts/character/generic/helpers/compact_object.coffee +7 -0
  13. data/app/assets/javascripts/character/generic/helpers/data_inputs.coffee +21 -0
  14. data/app/assets/javascripts/character/generic/helpers/date_select.coffee +45 -0
  15. data/app/assets/javascripts/character/generic/helpers/editor.coffee +11 -0
  16. data/app/assets/javascripts/character/generic/helpers/redactor.coffee +38 -0
  17. data/app/assets/javascripts/character/generic/helpers/reorder.coffee +36 -0
  18. data/app/assets/javascripts/character/generic/layout.coffee +40 -0
  19. data/app/assets/javascripts/character/generic/list.coffee +214 -0
  20. data/app/assets/javascripts/character/generic/model.coffee +135 -0
  21. data/app/assets/javascripts/character/generic/module.coffee +157 -0
  22. data/app/assets/javascripts/character/images/module.coffee +148 -0
  23. data/app/assets/javascripts/character/pages/module.coffee +43 -0
  24. data/app/assets/javascripts/character/posts/module.coffee +113 -0
  25. data/app/assets/javascripts/character/settings/_admins.coffee +61 -0
  26. data/app/assets/javascripts/character/settings/_authors.coffee +56 -0
  27. data/app/assets/javascripts/character/settings/_categories.coffee +61 -0
  28. data/app/assets/javascripts/character/settings/_layout.coffee +7 -0
  29. data/app/assets/javascripts/character/settings/_redirects.coffee +56 -0
  30. data/app/assets/javascripts/character/settings/_website.coffee +7 -0
  31. data/app/assets/javascripts/character/settings/details.coffee +16 -0
  32. data/app/assets/javascripts/character/settings/layout.coffee +46 -0
  33. data/app/assets/javascripts/character/settings/module.coffee +78 -0
  34. data/app/assets/stylesheets/character.scss +37 -0
  35. data/app/assets/stylesheets/character/_admins.scss +30 -0
  36. data/app/assets/stylesheets/character/_authors.scss +30 -0
  37. data/app/assets/stylesheets/character/_categories.scss +32 -0
  38. data/app/assets/stylesheets/character/_dashboard.scss +143 -0
  39. data/app/assets/stylesheets/character/_posts.scss +93 -0
  40. data/app/assets/stylesheets/character/_redirects.scss +35 -0
  41. data/app/assets/stylesheets/character/base.scss +967 -0
  42. data/app/assets/stylesheets/character/typography.scss +29 -0
  43. data/app/controllers/character/api_controller.rb +170 -0
  44. data/app/controllers/character/application_controller.rb +37 -0
  45. data/app/controllers/character/settings_controller.rb +72 -0
  46. data/app/controllers/concerns/character/auth_concern.rb +41 -0
  47. data/app/controllers/concerns/character/instance_concern.rb +31 -0
  48. data/app/controllers/concerns/character/json_object_concern.rb +32 -0
  49. data/app/controllers/concerns/character/model_class_concern.rb +28 -0
  50. data/app/controllers/concerns/character/params_concern.rb +33 -0
  51. data/app/controllers/concerns/character/templates_concern.rb +32 -0
  52. data/app/controllers/concerns/not_found.rb +18 -0
  53. data/app/controllers/concerns/website_settings.rb +18 -0
  54. data/app/controllers/pages_controller.rb +8 -0
  55. data/app/controllers/posts_controller.rb +43 -0
  56. data/app/helpers/character_helper.rb +8 -0
  57. data/app/helpers/page_helper.rb +67 -0
  58. data/app/inputs/foundation_string_input.rb +44 -0
  59. data/app/inputs/foundation_switch_input.rb +35 -0
  60. data/app/models/character/image.rb +12 -0
  61. data/app/models/character/page.rb +21 -0
  62. data/app/models/character/post.rb +32 -12
  63. data/app/models/character/post_author.rb +22 -0
  64. data/app/models/character/post_category.rb +21 -0
  65. data/app/models/character/redirect.rb +15 -0
  66. data/app/models/character/settings/variable.rb +23 -0
  67. data/app/models/character/sitemap/sitemap_generator_helper.rb +15 -0
  68. data/app/models/character/user.rb +29 -0
  69. data/app/models/concerns/created_ago.rb +12 -0
  70. data/app/models/concerns/hideable.rb +27 -0
  71. data/app/models/concerns/orderable.rb +8 -0
  72. data/app/models/concerns/report.rb +11 -0
  73. data/app/models/concerns/report_daily.rb +32 -0
  74. data/app/models/concerns/report_monthly.rb +18 -0
  75. data/app/models/concerns/report_weekly.rb +19 -0
  76. data/app/models/concerns/updated_ago.rb +12 -0
  77. data/app/models/reports/analytics_daily.rb +26 -0
  78. data/app/models/reports/analytics_monthly.rb +16 -0
  79. data/app/models/reports/analytics_weekly.rb +16 -0
  80. data/app/services/google_analytics.rb +43 -0
  81. data/app/uploaders/character/image_uploader.rb +22 -0
  82. data/app/uploaders/character/settings/file_uploader.rb +5 -0
  83. data/app/views/character/character.html.erb +67 -0
  84. data/app/views/character/generic/form.html.erb +8 -0
  85. data/app/views/character/pages/form.html.erb +28 -0
  86. data/app/views/character/posts/form.html.erb +38 -0
  87. data/app/views/character/settings/admins.html.erb +29 -0
  88. data/app/views/character/settings/post_authors.html.erb +28 -0
  89. data/app/views/character/settings/post_categories.html.erb +31 -0
  90. data/app/views/character/settings/redirects.html.erb +30 -0
  91. data/app/views/character/settings/settings_group.html.erb +67 -0
  92. data/app/views/errors/not_found.html.erb +157 -0
  93. data/app/views/pages/_default.html.erb +3 -0
  94. data/app/views/pages/_redactor.html.erb +3 -0
  95. data/app/views/pages/show.html.erb +5 -0
  96. data/app/views/posts/_post.html.erb +17 -0
  97. data/app/views/posts/author.html.erb +18 -0
  98. data/app/views/posts/category.html.erb +18 -0
  99. data/app/views/posts/index.html.erb +18 -0
  100. data/app/views/posts/rss.builder +19 -0
  101. data/app/views/posts/show.html.erb +14 -0
  102. data/app/views/shared/_google_analytics.html.erb +13 -0
  103. data/character.gemspec +48 -5
  104. data/doc/README_old.md +161 -0
  105. data/doc/generic_app.md +19 -0
  106. data/doc/img/demo-1.jpg +0 -0
  107. data/doc/img/demo-2.jpg +0 -0
  108. data/doc/img/demo-3.jpg +0 -0
  109. data/doc/img/demo-4.jpg +0 -0
  110. data/doc/img/demo-5.jpg +0 -0
  111. data/doc/instances.md +39 -0
  112. data/doc/settings.md +1 -0
  113. data/lib/character.rb +29 -1
  114. data/lib/character/engine.rb +33 -1
  115. data/lib/character/generators/bootstrap_generator.rb +51 -0
  116. data/lib/character/instance.rb +59 -0
  117. data/lib/character/routing.rb +42 -5
  118. data/lib/character/settings.rb +101 -0
  119. data/lib/character/templates/admin.coffee +15 -0
  120. data/lib/character/templates/admin.scss +3 -0
  121. data/lib/character/templates/application.html.erb +44 -0
  122. data/lib/character/templates/application.scss +12 -0
  123. data/lib/character/templates/assets.rb +1 -0
  124. data/lib/character/templates/initializer.rb +5 -0
  125. data/lib/character/templates/settings.scss +11 -0
  126. data/lib/character/templates/settings.yml +67 -0
  127. data/lib/character/templates/typography.scss +13 -0
  128. data/lib/character/version.rb +2 -2
  129. data/lib/mongoid/carrierwave_serialization_patch.rb +9 -0
  130. data/lib/tasks/analytics.rake +52 -0
  131. data/test/config/application.rb +65 -0
  132. data/test/config/mongoid.yml +12 -0
  133. data/test/config/secrets.yml +22 -0
  134. data/test/controllers/character/api_controller_test.rb +94 -0
  135. data/test/factories/product_factory.rb +5 -0
  136. data/test/lib/character/engine_test.rb +33 -0
  137. data/test/lib/character/routing_test.rb +31 -0
  138. data/test/test_helper.rb +48 -0
  139. data/vendor/assets/javascripts/backbone.js +944 -794
  140. data/vendor/assets/javascripts/jquery.fileupload.js +1426 -0
  141. data/vendor/assets/javascripts/jquery.form.js +1278 -0
  142. data/vendor/assets/javascripts/jquery.iframe-transport.js +214 -0
  143. data/vendor/assets/javascripts/raphael.js +8117 -0
  144. data/vendor/assets/javascripts/raphael.morris.js +1885 -0
  145. data/vendor/assets/javascripts/underscore.inflection.js +177 -0
  146. data/vendor/assets/javascripts/underscore.string.js +1 -1
  147. data/vendor/assets/stylesheets/csspinner.css +361 -0
  148. data/vendor/assets/stylesheets/normalize.css +423 -0
  149. metadata +499 -49
  150. data/app/controllers/character/posts_controller.rb +0 -27
  151. data/lib/generators/character/install_generator.rb +0 -42
  152. data/lib/generators/character/templates/README +0 -1
  153. data/lib/generators/character/templates/admin/character.rb +0 -3
  154. data/vendor/assets/fonts/general_foundicons.eot +0 -0
  155. data/vendor/assets/fonts/general_foundicons.svg +0 -15
  156. data/vendor/assets/fonts/general_foundicons.ttf +0 -0
  157. data/vendor/assets/fonts/general_foundicons.woff +0 -0
  158. data/vendor/assets/javascripts/character/index.js.coffee +0 -53
  159. data/vendor/assets/javascripts/character/models/post.js.coffee +0 -39
  160. data/vendor/assets/javascripts/character/views/app.js.coffee +0 -81
  161. data/vendor/assets/javascripts/character/views/editor.js.coffee +0 -231
  162. data/vendor/assets/javascripts/character/views/editor_settings.js.coffee +0 -44
  163. data/vendor/assets/javascripts/character/views/index.js.coffee +0 -116
  164. data/vendor/assets/javascripts/character/views/preview.js.coffee +0 -49
  165. data/vendor/assets/javascripts/jquery.smartresize.js +0 -30
  166. data/vendor/assets/javascripts/lodash.js +0 -4258
  167. data/vendor/assets/javascripts/showdown.js +0 -62
  168. data/vendor/assets/stylesheets/character/_base.css.scss +0 -84
  169. data/vendor/assets/stylesheets/character/_icons.css.scss.erb +0 -96
  170. data/vendor/assets/stylesheets/character/_view_editor.css.scss +0 -115
  171. data/vendor/assets/stylesheets/character/_view_index.css.scss +0 -73
  172. data/vendor/assets/stylesheets/character/_view_preview.css.scss +0 -49
  173. data/vendor/assets/stylesheets/character/index.css.scss +0 -32
@@ -0,0 +1,15 @@
1
+ class Character::Redirect
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include Mongoid::Attributes::Dynamic # required to remove users using _delete field
5
+
6
+ # attributes
7
+ field :path
8
+ field :destination
9
+ field :type, type: Integer, default: 301
10
+
11
+ TYPE_CHOICES = [ ["301", 301], ["302", 302] ].freeze
12
+
13
+ # indexes
14
+ index({ path: 1 })
15
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+ class Character::Settings::Variable
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ # attributes
7
+ field :group
8
+ field :name
9
+ field :value
10
+
11
+ # uploaders
12
+ mount_uploader :file, Character::Settings::FileUploader
13
+
14
+ # indexes
15
+ index({ group: 1, name: 1 })
16
+
17
+ # helpers
18
+ def has_file_uploaded?
19
+ return false if file.to_s.empty?
20
+ return false if file.to_s.end_with?('_old_')
21
+ return true
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ class Character::Sitemap::SitemapGeneratorHelper
2
+ def self.add_links(sitemap)
3
+ url_helpers = Rails.application.routes.url_helpers
4
+ url = "http://#{ @domain }"
5
+
6
+ sitemap.add "#{ url }#{ url_helpers.posts_index_path }",
7
+ changefreq: "daily"
8
+
9
+ Character::Post.published.each do |post|
10
+ sitemap.add "#{ url }#{ url_helpers.posts_show_path(post) }",
11
+ changefreq: "weekly",
12
+ lastmod: post.updated_at
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+ class Character::User
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include Mongoid::Attributes::Dynamic # required to remove users using _delete field
5
+
6
+ field :email
7
+ validates :email,
8
+ presence: true,
9
+ uniqueness: true#,
10
+ #format: { :with => /^([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i }
11
+
12
+ index({ email: 1 }, { unique: true })
13
+
14
+ # Methods -----------------------------------------------
15
+
16
+ def self.find_by_email(email)
17
+ where(email:email).first()
18
+ end
19
+
20
+ def gravatar_url(size)
21
+ hash = Digest::MD5.hexdigest(email)
22
+ # http://robohash.org
23
+ "https://robohash.org/bgset_bg2/#{hash}?gravatar=hashed&size=#{size}x#{size}"
24
+ end
25
+
26
+ def chr_thumbnail_url
27
+ gravatar_url(56)
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ module CreatedAgo
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ include Mongoid::Timestamps
6
+ include ActionView::Helpers::DateHelper
7
+
8
+ def created_ago
9
+ created_at ? "submitted #{time_ago_in_words(created_at)} ago" : ''
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,27 @@
1
+ # More options and details: https://github.com/joecorcoran/hideable
2
+ module Hideable
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ field :hidden, type: Boolean, default: false
7
+
8
+ scope :hidden, -> { where(hidden: true) }
9
+ scope :not_hidden, -> { where(hidden: false) }
10
+
11
+ def hidden?
12
+ self.hidden
13
+ end
14
+
15
+ def hide!
16
+ return if self.hidden?
17
+ self.hidden = true
18
+ self.save!
19
+ end
20
+
21
+ def unhide!
22
+ return unless self.hidden?
23
+ self.hidden = false
24
+ self.save!
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module Orderable
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ field :_position, type: Float, default: ->{ (self.class.all.first.try(:_position) || 1000) + 10 }
6
+ default_scope -> { order_by(_position: :desc) }
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: UTF-8
2
+ module Report
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ field :report_date, type: Date
7
+ validates_presence_of :report_date
8
+
9
+ default_scope -> { order_by(report_date: :asc) }
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: UTF-8
2
+ module ReportDaily
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include Report
7
+ end
8
+
9
+ def start_datetime
10
+ DateTime.new(report_date.year, report_date.month, report_date.day, 0, 0, 0)
11
+ end
12
+
13
+ def end_datetime
14
+ DateTime.new(report_date.year, report_date.month, report_date.day, 23, 59, 59)
15
+ end
16
+
17
+ def previous_report
18
+ self.class.where(report_date: report_date - 1.day).first
19
+ end
20
+
21
+ module ClassMethods
22
+ def update_report_for(date)
23
+ report = self.find_or_create_by(report_date: date)
24
+ report.update_report!()
25
+ return report
26
+ end
27
+
28
+ def update_report_for_today()
29
+ return self.update_report_for(Date.today)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: UTF-8
2
+ module ReportMonthly
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include Report
7
+ end
8
+
9
+ module ClassMethods
10
+ def update_current_report
11
+ today = Date.today
12
+ date = DateTime.new(today.year, today.month, 1)
13
+ report = self.find_or_create_by(report_date: date)
14
+ report.update_report!()
15
+ return report
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: UTF-8
2
+ module ReportWeekly
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include Report
7
+ end
8
+
9
+ module ClassMethods
10
+ def update_current_report
11
+ today = Date.today
12
+ week_day = today.cwday # Mon is 1
13
+ closest_monday = today - (week_day - 1).day
14
+ report = self.find_or_create_by(report_date: closest_monday)
15
+ report.update_report!()
16
+ return report
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ module UpdatedAgo
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ include Mongoid::Timestamps
6
+ include ActionView::Helpers::DateHelper
7
+
8
+ def updated_ago
9
+ updated_at ? "updated #{time_ago_in_words(updated_at)} ago" : ''
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: UTF-8
2
+ module Reports
3
+ class AnalyticsDaily
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include ReportDaily
7
+
8
+ field :visitors, type: Integer, default: 0
9
+
10
+ def update_report!
11
+ previous_report = self.previous_report
12
+ current_report = self
13
+
14
+ date1 = previous_report.report_date.strftime("%Y-%m-%d")
15
+ date2 = current_report.report_date.strftime("%Y-%m-%d")
16
+ ga = ::GoogleAnalytics.new()
17
+ visitors = ga.visitors(date1, date2)
18
+
19
+ previous_report.visitors = visitors[date1]
20
+ current_report.visitors = visitors[date2]
21
+
22
+ previous_report.save!
23
+ current_report.save!
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ module Reports
3
+ class AnalyticsMonthly
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include ReportMonthly
7
+
8
+ field :visitors, type: Integer, default: 0
9
+
10
+ def update_report!
11
+ daily_reports = AnalyticsDaily.gte(report_date: report_date).lte(report_date: report_date + 1.month - 1.day)
12
+ self.visitors = daily_reports.sum(:visitors)
13
+ self.save!
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ module Reports
3
+ class AnalyticsWeekly
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include ReportWeekly
7
+
8
+ field :visitors, type: Integer, default: 0
9
+
10
+ def update_report!
11
+ daily_reports = AnalyticsDaily.gte(report_date: report_date).lte(report_date: report_date + 1.week - 1.day)
12
+ self.visitors = daily_reports.sum(:visitors)
13
+ self.save!
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ require 'google/api_client'
2
+ require 'date'
3
+
4
+ class GoogleAnalytics
5
+ # https://developers.google.com/analytics/devguides/reporting/core/v3/reference#q_summary
6
+ # https://github.com/google/google-api-ruby-client-samples/blob/master/service_account/analytics.rb
7
+
8
+ def initialize
9
+ @client = Google::APIClient.new(:application_name => ENV['GA_APP_NAME'], :application_version => '1.0')
10
+ key_file = File.join('config', ENV['GA_KEY_FILE_NAME'])
11
+ key = Google::APIClient::PKCS12.load_key(key_file, 'notasecret')
12
+
13
+ service_account = Google::APIClient::JWTAsserter.new(
14
+ ENV['GA_SERVICE_ACCOUNT_EMAIL'],
15
+ ['https://www.googleapis.com/auth/analytics.readonly', 'https://www.googleapis.com/auth/prediction'],
16
+ key)
17
+ @client.authorization = service_account.authorize
18
+
19
+ @analytics = @client.discovered_api('analytics', 'v3')
20
+ end
21
+
22
+ def visitors(startDate, endDate)
23
+ results = @client.execute(:api_method => @analytics.data.ga.get, :parameters => {
24
+ 'ids' => "ga:" + ENV['GA_VIEW_ID'],
25
+ 'start-date' => startDate,
26
+ 'end-date' => endDate,
27
+ 'metrics' => "ga:visitors",
28
+ 'dimensions' => "ga:year,ga:month,ga:day",
29
+ 'sort' => "ga:year,ga:month,ga:day"
30
+ })
31
+
32
+ if results.error?
33
+ puts results.error_message
34
+ return {}
35
+ else
36
+ hash = {}
37
+ results.data.rows.each do |r|
38
+ hash["#{r[0]}-#{r[1]}-#{r[2]}"] = r[3].to_i
39
+ end
40
+ return hash
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ class Character::ImageUploader < CarrierWave::Uploader::Base
2
+ include CarrierWave::MiniMagick
3
+
4
+ def store_dir
5
+ "uploads/character/images/#{ model.id }"
6
+ end
7
+
8
+ # used for blog posts
9
+ version :regular do
10
+ process resize_to_fit: [800, 600]
11
+ end
12
+
13
+ # used for thumbnails in the list view
14
+ version :chr_thumb_small do
15
+ process resize_to_fill: [56, 56]
16
+ end
17
+
18
+ # used in gallery modal view
19
+ version :chr_thumb do
20
+ process resize_to_fill: [156, 156]
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ class Character::Settings::FileUploader < CarrierWave::Uploader::Base
2
+ def store_dir
3
+ "uploads/character/settings/files/#{ model.id }"
4
+ end
5
+ end
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width" />
6
+ <title><%= @character_instance.title %></title>
7
+
8
+ <!-- Stylesheets -->
9
+ <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&subset=cyrillic' rel='stylesheet' type='text/css'>
10
+ <%= stylesheet_link_tag @character_instance.stylesheet_filename, :media => 'all' %>
11
+ <style>
12
+ .chr-logo { background-image: url('<%= image_path(@character_instance.logo) %>'); }
13
+ .chr-login { background-image: url("<%= image_path(@character_instance.login_background) %>"); }
14
+ </style>
15
+
16
+ <%= javascript_include_tag 'browserid' %>
17
+ <%= setup_browserid debug: false %>
18
+ <%= csrf_meta_tags %>
19
+ </head>
20
+
21
+ <body>
22
+ <% if @current_user %>
23
+ <script>
24
+ $(function() {
25
+ var chrParams = { user_email: '<%= @current_user.email %>', url: '/<%= @character_instance.name %>' };
26
+ chr.start(chrParams);
27
+ });
28
+ </script>
29
+
30
+ <div id='character' class='character <%= @character_instance.name %>-instance'>
31
+ <nav id='menu' class='chr-menu'>
32
+
33
+ <%= link_to "/#{ @character_instance.name }/logout?redirect=/#{ @character_instance.name }", class: 'browserid_logout', title: 'Sign out' do %>
34
+ <%= image_tag @current_user.gravatar_url(36), class: 'chr-menu-user' %>
35
+ <% end %>
36
+
37
+ <ul id='menu_items'></ul>
38
+ <a href="#/settings" class="chr-menu-item-settings" title='Settings'>
39
+ <i class="chr-menu-icon fa fa-gears"></i>
40
+ <div class='chr-menu-title'>Settings</div>
41
+ </a>
42
+ </nav>
43
+ <div id='content' class='chr-content'></div>
44
+ </div>
45
+
46
+ <%= javascript_include_tag @character_instance.javascript_filename %>
47
+ <% else %>
48
+
49
+ <% if @browserid_email %>
50
+
51
+ <div class='chr-no-access'>
52
+ <h2>Hi!</h2>
53
+ <p>You're signed in with <strong><%= @browserid_email %></strong>. Your account has no access to this section of the website. Please ask the administrator to grant you access.</p>
54
+
55
+ <%= link_to "/#{ @character_instance.name }/logout?redirect=/#{ @character_instance.name }", class: 'browserid_logout' do %>Sign out<% end %>
56
+ </div>
57
+
58
+ <% else %>
59
+
60
+ <div class='chr-login'>
61
+ <%= link_to browserid_config.login.path, class: 'browserid_login' do %>Sign in<% end %>
62
+ </div>
63
+
64
+ <% end %>
65
+ <% end %>
66
+ </body>
67
+ </html>