hicube 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +24 -0
  4. data/app/assets/images/hicube/avatar.png +0 -0
  5. data/app/assets/images/hicube/dnd.png +0 -0
  6. data/app/assets/images/hicube/noimagefound.png +0 -0
  7. data/app/assets/javascripts/hicube/accounts.js +0 -0
  8. data/app/assets/javascripts/hicube/application.js +52 -0
  9. data/app/assets/javascripts/hicube/contents.js +2 -0
  10. data/app/assets/javascripts/hicube/documents.js +10 -0
  11. data/app/assets/javascripts/hicube/pages.coffee +7 -0
  12. data/app/assets/javascripts/hicube/public/pages.coffee +0 -0
  13. data/app/assets/javascripts/hicube/snippets.coffee +0 -0
  14. data/app/assets/javascripts/hicube.js +128 -0
  15. data/app/assets/stylesheets/hicube/accounts.css +0 -0
  16. data/app/assets/stylesheets/hicube/application.css +22 -0
  17. data/app/assets/stylesheets/hicube/contents.css +4 -0
  18. data/app/assets/stylesheets/hicube/documents.css +24 -0
  19. data/app/assets/stylesheets/hicube/pages.css +10 -0
  20. data/app/assets/stylesheets/hicube/public/pages.css +4 -0
  21. data/app/assets/stylesheets/hicube/snippets.css +4 -0
  22. data/app/assets/stylesheets/hicube.css +18 -0
  23. data/app/controllers/hicube/accounts_controller.rb +66 -0
  24. data/app/controllers/hicube/application_controller.rb +181 -0
  25. data/app/controllers/hicube/base_controller.rb +148 -0
  26. data/app/controllers/hicube/contents_controller.rb +53 -0
  27. data/app/controllers/hicube/documents_controller.rb +85 -0
  28. data/app/controllers/hicube/pages_controller.rb +106 -0
  29. data/app/controllers/hicube/public/base_controller.rb +92 -0
  30. data/app/controllers/hicube/public/pages_controller.rb +62 -0
  31. data/app/controllers/hicube/snippets_controller.rb +100 -0
  32. data/app/helpers/hicube/application_helper.rb +74 -0
  33. data/app/helpers/hicube/contents_helper.rb +4 -0
  34. data/app/helpers/hicube/documents_helper.rb +4 -0
  35. data/app/helpers/hicube/pages_helper.rb +4 -0
  36. data/app/helpers/hicube/public/pages_helper.rb +19 -0
  37. data/app/helpers/hicube/snippets_helper.rb +4 -0
  38. data/app/mailers/hicube/application_mailer.rb +8 -0
  39. data/app/mailers/hicube/page_mailer.rb +13 -0
  40. data/app/models/hicube/account.rb +26 -0
  41. data/app/models/hicube/content.rb +30 -0
  42. data/app/models/hicube/document.rb +46 -0
  43. data/app/models/hicube/page.rb +98 -0
  44. data/app/models/hicube/snippet.rb +20 -0
  45. data/app/models/hicube/tag.rb +19 -0
  46. data/app/models/hicube/user.rb +67 -0
  47. data/app/uploaders/hicube/file_uploader.rb +53 -0
  48. data/app/uploaders/hicube/image_uploader.rb +53 -0
  49. data/app/views/devise/mailer/confirmation_instructions.html.slim +8 -0
  50. data/app/views/devise/mailer/reset_password_instructions.html.slim +12 -0
  51. data/app/views/devise/mailer/unlock_instructions.html.slim +10 -0
  52. data/app/views/devise/passwords/edit.html.slim +22 -0
  53. data/app/views/devise/passwords/new.html.slim +15 -0
  54. data/app/views/devise/sessions/new.html.slim +24 -0
  55. data/app/views/hicube/accounts/_form.html.slim +31 -0
  56. data/app/views/hicube/accounts/_navigation.html.slim +25 -0
  57. data/app/views/hicube/accounts/edit.html.slim +4 -0
  58. data/app/views/hicube/accounts/index.html.slim +12 -0
  59. data/app/views/hicube/accounts/new.html.slim +4 -0
  60. data/app/views/hicube/accounts/show.html.slim +21 -0
  61. data/app/views/hicube/base/_flash.html.slim +36 -0
  62. data/app/views/hicube/base/_footer.html.slim +10 -0
  63. data/app/views/hicube/base/_header.html.slim +31 -0
  64. data/app/views/hicube/base/_navigation.html.slim +16 -0
  65. data/app/views/hicube/base/_sidebar.html.slim +122 -0
  66. data/app/views/hicube/contents/_form.html.slim +11 -0
  67. data/app/views/hicube/contents/edit.html.slim +9 -0
  68. data/app/views/hicube/contents/new.html.slim +9 -0
  69. data/app/views/hicube/documents/_form.html.slim +18 -0
  70. data/app/views/hicube/documents/_navigation.html.slim +25 -0
  71. data/app/views/hicube/documents/edit.html.slim +9 -0
  72. data/app/views/hicube/documents/index.html.slim +57 -0
  73. data/app/views/hicube/documents/new.html.slim +9 -0
  74. data/app/views/hicube/page_mailer/notify.html.slim +1 -0
  75. data/app/views/hicube/page_mailer/notify.text.slim +8 -0
  76. data/app/views/hicube/pages/_form.html.slim +153 -0
  77. data/app/views/hicube/pages/_navigation.html.slim +27 -0
  78. data/app/views/hicube/pages/edit.html.slim +9 -0
  79. data/app/views/hicube/pages/index.html.slim +32 -0
  80. data/app/views/hicube/pages/index.json.jbuilder +4 -0
  81. data/app/views/hicube/pages/new.html.slim +9 -0
  82. data/app/views/hicube/pages/show.html.slim +2 -0
  83. data/app/views/hicube/pages/show.json.jbuilder +1 -0
  84. data/app/views/hicube/public/pages/edit.html.slim +11 -0
  85. data/app/views/hicube/public/pages/show.html.slim +17 -0
  86. data/app/views/hicube/snippets/_form.html.slim +21 -0
  87. data/app/views/hicube/snippets/_navigation.html.slim +25 -0
  88. data/app/views/hicube/snippets/edit.html.slim +9 -0
  89. data/app/views/hicube/snippets/index.html.slim +25 -0
  90. data/app/views/hicube/snippets/new.html.slim +9 -0
  91. data/app/views/layouts/hicube/application.html.slim +26 -0
  92. data/app/views/layouts/hicube.html.slim +10 -0
  93. data/app/views/layouts/mailer.html.slim +3 -0
  94. data/app/views/layouts/mailer.text.slim +1 -0
  95. data/config/initializers/carrierwave.rb +12 -0
  96. data/config/initializers/devise.rb +282 -0
  97. data/config/initializers/liquid.rb +4 -0
  98. data/config/initializers/markdown.rb +7 -0
  99. data/config/locales/en.yml +18 -0
  100. data/config/routes.rb +40 -0
  101. data/lib/generators/hicube/install/install_generator.rb +49 -0
  102. data/lib/generators/hicube/install/templates/generate_hicube_accounts.rb +12 -0
  103. data/lib/generators/hicube/install/templates/generate_hicube_pages.rb +14 -0
  104. data/lib/generators/hicube/install/templates/generate_hicube_users.rb +14 -0
  105. data/lib/generators/hicube/install/templates/sitemap.rb +17 -0
  106. data/lib/hicube/engine.rb +6 -0
  107. data/lib/hicube/liquid/tags/content.rb +31 -0
  108. data/lib/hicube/liquid/tags/img.rb +21 -0
  109. data/lib/hicube/liquid/tags/snippet.rb +40 -0
  110. data/lib/hicube/liquid/tags/url.rb +21 -0
  111. data/lib/hicube/version.rb +3 -0
  112. data/lib/hicube.rb +30 -0
  113. data/lib/tasks/hicube_tasks.rake +4 -0
  114. metadata +576 -0
@@ -0,0 +1,27 @@
1
+ - if current_page?(action: 'new')
2
+ - heading = 'New'
3
+ - subheading = 'Page'
4
+ - elsif current_page?(action: 'index')
5
+ - heading = 'Pages'
6
+ - subheading = 'All'
7
+ - elsif current_page?(action: 'edit')
8
+ - heading = "#{@page}"
9
+ - subheading = 'Edit'
10
+
11
+ section.content-header
12
+ h1
13
+ / | #{heading} #{(current_page?(action: 'index') ? controller_name.camelize : controller_name.singularize.camelize)}
14
+ | #{heading}
15
+ small
16
+ | #{subheading}
17
+ ol.breadcrumb
18
+ li
19
+ a href=pages_path
20
+ i.fa.fa-dashboard
21
+ | Home
22
+ li class=(current_page?(eval("#{controller_name}_path")) ? :active : nil)
23
+ a href="#{controller_name}_path"
24
+ = controller_name.camelize
25
+ - unless current_page?(eval("#{controller_name}_path"))
26
+ li.active
27
+ | #{heading}
@@ -0,0 +1,9 @@
1
+ section.content
2
+ = form_for @page, as: :page, url: page_path(@page), role: 'form' do |f|
3
+ .box.no-border
4
+ .box-body
5
+ = render partial: 'form', locals: { f: f, parent_id: ((@page.present? and !@page.parent.nil?) ? @page.parent.id.to_s : '')}
6
+ .box-footer.no-border
7
+ button.btn.btn-flat.btn-primary.pull-right[type="submit"]
8
+ | Save
9
+ = link_to 'Delete', page_path(@page), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-flat btn-danger'
@@ -0,0 +1,32 @@
1
+ section.content
2
+ .row
3
+ .col-md-12
4
+ .box
5
+ .box-body.table-responsive
6
+ table#datatable.table.table-bordered.table-striped
7
+ thead
8
+ tr
9
+ th
10
+ .col-md-11
11
+ = Hicube::Page.human_attribute_name(:title)
12
+ .col-md-1
13
+ tbody
14
+ - @pages.parents.each do |p|
15
+ tr
16
+ td
17
+ .col-md-11
18
+ = p.title
19
+ .col-md-1
20
+ = link_to t('edit'), edit_page_path(p), class: 'btn btn-sm btn-primary'
21
+ - p.children.each do |child|
22
+ tr
23
+ td
24
+ .col-xs-11
25
+ |  
26
+ i.fa.fa-angle-double-right
27
+ '
28
+ = child.title
29
+ .col-xs-1
30
+ = link_to t('edit'), edit_page_path(child), class: 'btn btn-sm btn-primary'
31
+ .box-footer
32
+ = link_to 'New Page', new_page_path, class: 'btn btn-flat btn-success pull-right'
@@ -0,0 +1,4 @@
1
+ json.array!(@pages) do |page|
2
+ json.extract! page, :id
3
+ json.url page_url(page, format: :json)
4
+ end
@@ -0,0 +1,9 @@
1
+ section.content
2
+ = form_for :page, url: pages_path, role: 'form' do |f|
3
+ .box.no-border
4
+ .box-body
5
+ = render partial: 'form', locals: { f: f, parent_id: ((@page.present? and @page.junction?) ? @page.parent.id : '') }
6
+ .box-footer.no-border
7
+ button.btn.btn-flat.btn-primary.pull-right[type="submit"]
8
+ | Submit
9
+ = link_to 'Cancel', pages_path, class: 'btn btn-flat btn-default'
@@ -0,0 +1,2 @@
1
+ / section.content.invoice
2
+ / iframe#rails_iframe height="100%" src=page_path(@page) frameborder="0" width="100%"
@@ -0,0 +1 @@
1
+ json.extract! @page, :id, :created_at, :updated_at
@@ -0,0 +1,11 @@
1
+ = raw @page_content
2
+
3
+ coffee:
4
+ $(document).ready ->
5
+ $.fn.editable.defaults.mode = 'inline'
6
+ $('.editable').editable
7
+ type: 'wysihtml5'
8
+ url: '/hicube/pages/about/contents/' + $(this).data('pk')
9
+ name: 'content[body]'
10
+
11
+ return
@@ -0,0 +1,17 @@
1
+ - content_for :head do
2
+ title #{@page.seo_title}
3
+ meta name="keywords" content="#{@page.seo_keywords}"
4
+ meta name="description" content="#{@page.seo_description}"
5
+ - @page.head.each do |c|
6
+ meta name="#{c.name}" content="#{c.body}"
7
+
8
+ = raw @page_content
9
+
10
+
11
+ / body id="#{@page.div}" class=""
12
+ / = raw "#{Hicube::Markdown.render(@header).html_safe}"
13
+ / = raw "#{Hicube::Markdown.render(@page_content).html_safe}"
14
+
15
+
16
+ / = raw ::Slim::Template.new("#{Rails.root}/tmp/page.slim").render
17
+
@@ -0,0 +1,21 @@
1
+ .box-body
2
+ .form-group
3
+ = f.label :name
4
+ = f.text_field :name, placeholder: 'Enter ...', class: 'form-control'
5
+
6
+ .form-group
7
+ = f.label :body
8
+ - if current_page?(new_snippet_path)
9
+ = f.text_area :body, id: "textarea", value: "\n\n\n\n\n\n\n\n", class: 'form-control'
10
+ - else
11
+ = f.text_area :body, id: "textarea", class: 'form-control'
12
+ .box-footer
13
+ button.btn.btn-flat.btn-primary.pull-right[type="submit"]
14
+ - if current_page?(new_snippet_path)
15
+ | Submit
16
+ - else
17
+ | Save
18
+ - if current_page?(new_snippet_path)
19
+ = link_to 'Cancel', snippets_path, class: 'btn btn-flat btn-default'
20
+ - else
21
+ = link_to 'Delete', snippet_path(@snippet), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-flat btn-danger'
@@ -0,0 +1,25 @@
1
+ - if current_page?(action: 'new')
2
+ - heading = 'New'
3
+ - subheading = 'Add'
4
+ - elsif current_page?(action: 'edit')
5
+ / - heading = 'Edit'
6
+ - subheading = 'Edit'
7
+ - else
8
+ - subheading = ''
9
+
10
+ section.content-header
11
+ h1
12
+ | #{heading} #{(current_page?(action: 'index') ? controller_name.camelize : controller_name.singularize.camelize)}
13
+ small
14
+ | #{subheading}
15
+ ol.breadcrumb
16
+ li
17
+ a href=pages_path
18
+ i.fa.fa-dashboard
19
+ | Home
20
+ li class=(current_page?(eval("#{controller_name}_path")) ? :active : nil)
21
+ a href="#{controller_name}_path"
22
+ = controller_name.camelize
23
+ - unless current_page?(eval("#{controller_name}_path"))
24
+ li.active
25
+ | #{heading} #{controller_name.singularize.camelize}
@@ -0,0 +1,9 @@
1
+ section.content
2
+ .row
3
+ .col-md-12
4
+ .box.box-primary
5
+ / .box-header
6
+ / h3.box-title
7
+ / | Snippet Details
8
+ = form_for @snippet, as: :snippet, url: snippet_path(@snippet), role: 'form' do |f|
9
+ = render partial: 'form', locals: { f: f }
@@ -0,0 +1,25 @@
1
+ section.content
2
+ .row
3
+ .col-md-12
4
+ .box.box-primary
5
+ / .box-header
6
+ / h3.box-title
7
+ / | Snippets
8
+ .box-body.table-responsive
9
+ table#datatable.table.table-bordered.table-striped
10
+ thead
11
+ tr
12
+ th
13
+ .col-md-11
14
+ = Hicube::Snippet.human_attribute_name(:name)
15
+ .col-md-1
16
+ tbody
17
+ - @snippets.each do |s|
18
+ tr
19
+ td
20
+ .col-md-11
21
+ = s.name
22
+ .col-md-1
23
+ = link_to t('edit'), edit_snippet_path(s), class: 'btn btn-sm btn-primary'
24
+ .box-footer
25
+ = link_to 'New Snippet', new_snippet_path, class: 'btn btn-flat btn-success pull-right'
@@ -0,0 +1,9 @@
1
+ section.content
2
+ .row
3
+ .col-md-12
4
+ .box.box-primary
5
+ / .box-header
6
+ / h3.box-title
7
+ / | Snippet Details
8
+ = form_for :snippet, url: snippets_path, role: 'form' do |f|
9
+ = render partial: 'form', locals: { f: f}
@@ -0,0 +1,26 @@
1
+ doctype html
2
+ html
3
+ head
4
+ meta[charset="utf-8"]
5
+ meta[name="viewport" content="width=device-width, initial-scale=1.0"]
6
+
7
+ title #{app_name}
8
+ = stylesheet_link_tag 'hicube/application', media: 'all', 'data-turbolinks-track' => true
9
+ = javascript_include_tag 'hicube/application', 'data-turbolinks-track' => true
10
+ = csrf_meta_tags
11
+
12
+ - if user_signed_in?
13
+ body.skin-blue
14
+ /.sidebar-collapse.sidebar-mini
15
+ .wrapper
16
+ = render partial: 'header'
17
+ aside.main-sidebar
18
+ = render partial: 'sidebar'
19
+ .content-wrapper
20
+ = render partial: 'flash'
21
+ = render partial: 'navigation'
22
+ = yield
23
+ footer.main-footer
24
+ = render partial: 'footer'
25
+ - else
26
+ = yield
@@ -0,0 +1,10 @@
1
+ doctype html
2
+ html
3
+ head
4
+ = yield :head
5
+ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
6
+ = javascript_include_tag 'application', 'data-turbolinks-track' => true
7
+ = analytics_init if Rails.env.production?
8
+ = csrf_meta_tags
9
+ body
10
+ = yield
@@ -0,0 +1,3 @@
1
+ html
2
+ body
3
+ = yield
@@ -0,0 +1 @@
1
+ = yield
@@ -0,0 +1,12 @@
1
+ CarrierWave.configure do |config|
2
+ config.storage = :aws
3
+ config.aws_bucket = ENV["S3_BUCKET_NAME"]
4
+ config.aws_acl = :public_read
5
+ config.asset_host = "#{ENV["AWS_ASSET_HOST"]}/#{ENV["S3_BUCKET_NAME"]}"
6
+ config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365
7
+
8
+ config.aws_credentials = {
9
+ access_key_id: ENV["AWS_ACCESS_KEY_ID"],
10
+ secret_access_key: ENV["AWS_ACCESS_KEY"]}
11
+ config.root = Rails.root.join('tmp')
12
+ end
@@ -0,0 +1,282 @@
1
+ module Hicube
2
+ module Devise
3
+ class FailureApp < ::Devise::FailureApp
4
+
5
+ # include ::Hicube::Engine.routes
6
+
7
+ def redirect_url
8
+ # FIXME: Not sure why cannot see new_user_session_path here
9
+ # new_user_session_path
10
+ '/hicube/sign_in'
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+
17
+ # Use this hook to configure devise mailer, warden hooks and so forth.
18
+ # Many of these configuration options can be set straight in your model.
19
+ Devise.setup do |config|
20
+
21
+ # Make devise to inherit from engines ApplicationController rather than parent App
22
+ config.parent_controller = 'Hicube::ApplicationController'
23
+
24
+ # Route where engine is mounted
25
+ config.router_name = :hicube
26
+
27
+ # The secret key used by Devise. Devise uses this key to generate
28
+ # random tokens. Changing this key will render invalid all existing
29
+ # confirmation, reset password and unlock tokens in the database.
30
+ # config.secret_key = '88b722e32d06a324b4a54572f168fcccd3dc9c050b922d5fe4f22a6ef17f5091b90541f84655c0d6eada1813fc91a7260d4a85cbf610256cfc343b672d6a8c26'
31
+
32
+ # ==> Mailer Configuration
33
+ # Configure the e-mail address which will be shown in Devise::Mailer,
34
+ # note that it will be overwritten if you use your own mailer class
35
+ # with default "from" parameter.
36
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
37
+
38
+ # Configure the class responsible to send e-mails.
39
+ # config.mailer = 'Devise::Mailer'
40
+
41
+ # ==> ORM configuration
42
+ # Load and configure the ORM. Supports :active_record (default) and
43
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
44
+ # available as additional gems.
45
+ require 'devise/orm/mongoid'
46
+
47
+ # ==> Configuration for any authentication mechanism
48
+ # Configure which keys are used when authenticating a user. The default is
49
+ # just :email. You can configure it to use [:username, :subdomain], so for
50
+ # authenticating a user, both parameters are required. Remember that those
51
+ # parameters are used only when authenticating and not when retrieving from
52
+ # session. If you need permissions, you should implement that in a before filter.
53
+ # You can also supply a hash where the value is a boolean determining whether
54
+ # or not authentication should be aborted when the value is not present.
55
+ # config.authentication_keys = [ :email ]
56
+
57
+ # Configure parameters from the request object used for authentication. Each entry
58
+ # given should be a request method and it will automatically be passed to the
59
+ # find_for_authentication method and considered in your model lookup. For instance,
60
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
61
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
62
+ # config.request_keys = []
63
+
64
+ # Configure which authentication keys should be case-insensitive.
65
+ # These keys will be downcased upon creating or modifying a user and when used
66
+ # to authenticate or find a user. Default is :email.
67
+ config.case_insensitive_keys = [ :email ]
68
+
69
+ # Configure which authentication keys should have whitespace stripped.
70
+ # These keys will have whitespace before and after removed upon creating or
71
+ # modifying a user and when used to authenticate or find a user. Default is :email.
72
+ config.strip_whitespace_keys = [ :email ]
73
+
74
+ # Tell if authentication through request.params is enabled. True by default.
75
+ # It can be set to an array that will enable params authentication only for the
76
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
77
+ # enable it only for database (email + password) authentication.
78
+ # config.params_authenticatable = true
79
+
80
+ # Tell if authentication through HTTP Auth is enabled. False by default.
81
+ # It can be set to an array that will enable http authentication only for the
82
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
83
+ # enable it only for database authentication. The supported strategies are:
84
+ # :database = Support basic authentication with authentication key + password
85
+ # config.http_authenticatable = false
86
+
87
+ # If 401 status code should be returned for AJAX requests. True by default.
88
+ # config.http_authenticatable_on_xhr = true
89
+
90
+ # The realm used in Http Basic Authentication. 'Application' by default.
91
+ # config.http_authentication_realm = 'Application'
92
+
93
+ # It will change confirmation, password recovery and other workflows
94
+ # to behave the same regardless if the e-mail provided was right or wrong.
95
+ # Does not affect registerable.
96
+ # config.paranoid = true
97
+
98
+ # By default Devise will store the user in session. You can skip storage for
99
+ # particular strategies by setting this option.
100
+ # Notice that if you are skipping storage for all authentication paths, you
101
+ # may want to disable generating routes to Devise's sessions controller by
102
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
103
+ config.skip_session_storage = [:http_auth]
104
+
105
+ # By default, Devise cleans up the CSRF token on authentication to
106
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
107
+ # requests for sign in and sign up, you need to get a new CSRF token
108
+ # from the server. You can disable this option at your own risk.
109
+ # config.clean_up_csrf_token_on_authentication = true
110
+
111
+ # ==> Configuration for :database_authenticatable
112
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
113
+ # using other encryptors, it sets how many times you want the password re-encrypted.
114
+ #
115
+ # Limiting the stretches to just one in testing will increase the performance of
116
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
117
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
118
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
119
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
120
+ config.stretches = Rails.env.test? ? 1 : 10
121
+
122
+ # Setup a pepper to generate the encrypted password.
123
+ # config.pepper = 'b1acf284ca316ca644045632a7d6b937576d965b69520ec230f96d055d501f5d52f624196f9508671ac288d49efb755896c4f45e47026895a27e29a70b06bd61'
124
+
125
+ # ==> Configuration for :confirmable
126
+ # A period that the user is allowed to access the website even without
127
+ # confirming their account. For instance, if set to 2.days, the user will be
128
+ # able to access the website for two days without confirming their account,
129
+ # access will be blocked just in the third day. Default is 0.days, meaning
130
+ # the user cannot access the website without confirming their account.
131
+ # config.allow_unconfirmed_access_for = 2.days
132
+
133
+ # A period that the user is allowed to confirm their account before their
134
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
135
+ # their account within 3 days after the mail was sent, but on the fourth day
136
+ # their account can't be confirmed with the token any more.
137
+ # Default is nil, meaning there is no restriction on how long a user can take
138
+ # before confirming their account.
139
+ # config.confirm_within = 3.days
140
+
141
+ # If true, requires any email changes to be confirmed (exactly the same way as
142
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
143
+ # db field (see migrations). Until confirmed, new email is stored in
144
+ # unconfirmed_email column, and copied to email column on successful confirmation.
145
+ config.reconfirmable = true
146
+
147
+ # Defines which key will be used when confirming an account
148
+ # config.confirmation_keys = [ :email ]
149
+
150
+ # ==> Configuration for :rememberable
151
+ # The time the user will be remembered without asking for credentials again.
152
+ # config.remember_for = 2.weeks
153
+
154
+ # Invalidates all the remember me tokens when the user signs out.
155
+ config.expire_all_remember_me_on_sign_out = true
156
+
157
+ # If true, extends the user's remember period when remembered via cookie.
158
+ # config.extend_remember_period = false
159
+
160
+ # Options to be passed to the created cookie. For instance, you can set
161
+ # secure: true in order to force SSL only cookies.
162
+ # config.rememberable_options = {}
163
+
164
+ # ==> Configuration for :validatable
165
+ # Range for password length.
166
+ config.password_length = 4..128
167
+
168
+ # Email regex used to validate email formats. It simply asserts that
169
+ # one (and only one) @ exists in the given string. This is mainly
170
+ # to give user feedback and not to assert the e-mail validity.
171
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
172
+
173
+ # ==> Configuration for :timeoutable
174
+ # The time you want to timeout the user session without activity. After this
175
+ # time the user will be asked for credentials again. Default is 30 minutes.
176
+ # config.timeout_in = 30.minutes
177
+
178
+ # If true, expires auth token on session timeout.
179
+ # config.expire_auth_token_on_timeout = false
180
+
181
+ # ==> Configuration for :lockable
182
+ # Defines which strategy will be used to lock an account.
183
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
184
+ # :none = No lock strategy. You should handle locking by yourself.
185
+ # config.lock_strategy = :failed_attempts
186
+
187
+ # Defines which key will be used when locking and unlocking an account
188
+ # config.unlock_keys = [ :email ]
189
+
190
+ # Defines which strategy will be used to unlock an account.
191
+ # :email = Sends an unlock link to the user email
192
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
193
+ # :both = Enables both strategies
194
+ # :none = No unlock strategy. You should handle unlocking by yourself.
195
+ # config.unlock_strategy = :both
196
+
197
+ # Number of authentication tries before locking an account if lock_strategy
198
+ # is failed attempts.
199
+ # config.maximum_attempts = 20
200
+
201
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
202
+ # config.unlock_in = 1.hour
203
+
204
+ # Warn on the last attempt before the account is locked.
205
+ # config.last_attempt_warning = true
206
+
207
+ # ==> Configuration for :recoverable
208
+ #
209
+ # Defines which key will be used when recovering the password for an account
210
+ # config.reset_password_keys = [ :email ]
211
+
212
+ # Time interval you can reset your password with a reset password key.
213
+ # Don't put a too small interval or your users won't have the time to
214
+ # change their passwords.
215
+ config.reset_password_within = 6.hours
216
+
217
+ # ==> Configuration for :encryptable
218
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
219
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
220
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
221
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
222
+ # REST_AUTH_SITE_KEY to pepper).
223
+ #
224
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
225
+ # config.encryptor = :sha512
226
+
227
+ # ==> Scopes configuration
228
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
229
+ # "users/sessions/new". It's turned off by default because it's slower if you
230
+ # are using only default views.
231
+ # config.scoped_views = false
232
+
233
+ # Configure the default scope given to Warden. By default it's the first
234
+ # devise role declared in your routes (usually :user).
235
+ # config.default_scope = :user
236
+
237
+ # Set this configuration to false if you want /users/sign_out to sign out
238
+ # only the current scope. By default, Devise signs out all scopes.
239
+ # config.sign_out_all_scopes = true
240
+
241
+ # ==> Navigation configuration
242
+ # Lists the formats that should be treated as navigational. Formats like
243
+ # :html, should redirect to the sign in page when the user does not have
244
+ # access, but formats like :xml or :json, should return 401.
245
+ #
246
+ # If you have any extra navigational formats, like :iphone or :mobile, you
247
+ # should add them to the navigational formats lists.
248
+ #
249
+ # The "*/*" below is required to match Internet Explorer requests.
250
+ # config.navigational_formats = ['*/*', :html]
251
+
252
+ # The default HTTP method used to sign out a resource. Default is :delete.
253
+ config.sign_out_via = :delete
254
+
255
+ # ==> OmniAuth
256
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
257
+ # up on your models and hooks.
258
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
259
+
260
+ # ==> Warden configuration
261
+ # If you want to use other strategies, that are not supported by Devise, or
262
+ # change the failure app, you can configure them inside the config.warden block.
263
+ #
264
+ # config.warden do |manager|
265
+ # manager.intercept_401 = false
266
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
267
+ # end
268
+
269
+ # ==> Mountable engine configurations
270
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
271
+ # is mountable, there are some extra configurations to be taken into account.
272
+ # The following options are available, assuming the engine is mounted as:
273
+ #
274
+ # mount MyEngine, at: '/my_engine'
275
+ #
276
+ # The router that invoked `devise_for`, in the example above, would be:
277
+ # config.router_name = :my_engine
278
+ #
279
+ # When using omniauth, Devise cannot automatically set Omniauth path,
280
+ # so you need to do it manually. For the users scope, it would be:
281
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
282
+ end
@@ -0,0 +1,4 @@
1
+ require 'hicube/liquid/tags/img'
2
+ require 'hicube/liquid/tags/url'
3
+ require 'hicube/liquid/tags/snippet'
4
+ require 'hicube/liquid/tags/content'
@@ -0,0 +1,7 @@
1
+ class MultiRenderer < Redcarpet::Render::HTML
2
+ include Redcarpet::Render::SmartyPants
3
+ end
4
+
5
+ module Hicube
6
+ Markdown = Redcarpet::Markdown.new(MultiRenderer)
7
+ end
@@ -0,0 +1,18 @@
1
+ components:
2
+ markdown_editor:
3
+ insert_image:
4
+ input_label: 'Filename'
5
+ en:
6
+ messages:
7
+ resource:
8
+ created: "Created %{type}: %{resource}."
9
+ destroyed: "Deleted %{type}: %{resource}."
10
+ missing_parameters: "Missing mandatory parameters for %{type}."
11
+ not_found: "Could not find %{type} matching %{criteria}: %{value}."
12
+ not_permitted: "You do not have permission to view %{type}: %{resource}."
13
+ not_valid: "Validation failed: %{errors}"
14
+ updated: "Updated %{type}: %{resource}."
15
+ tested: "Test message has been sent to %{resource}."
16
+ invite:
17
+ not_valid: Email address already taken or not valid.
18
+ already_exists: User already exists
data/config/routes.rb ADDED
@@ -0,0 +1,40 @@
1
+ Hicube::Engine.routes.draw do
2
+
3
+ root 'hicube/pages#show'
4
+
5
+ devise_for :users,
6
+ class_name: 'Hicube::User',
7
+ path: '',
8
+ path_prefix: nil,
9
+ failure_app: 'Hicube::Devise::FailureApp',
10
+ module: :devise
11
+
12
+ resources :pages do
13
+ resources :contents
14
+ end
15
+
16
+ resources :snippets
17
+
18
+ resources :documents
19
+
20
+ resource :tag
21
+
22
+ resource :account
23
+ end
24
+
25
+ Rails.application.routes.draw do
26
+
27
+ root 'hicube/public/pages#show', id: 'index'
28
+
29
+ get ':id', to: 'hicube/public/pages#show', only: [:show]
30
+ get ':id/edit', to: 'hicube/public/pages#edit', only: [:edit]
31
+ post 'mail', to: 'hicube/public/pages#mail', only: [:mail]
32
+ # get '/', to: 'hicube/pages#show'
33
+ # match '*path' => 'hicube/pages#show', via: :all
34
+
35
+ namespace :public do
36
+ resources :pages, only: [:show, :edit]
37
+ end
38
+
39
+ get 'hicube/public/pages/:id', to: redirect('/%{id}')
40
+ end