thesis 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. data/LICENSE.txt +22 -0
  2. data/README.md +3 -3
  3. data/app/assets/javascripts/thesis/hallo.js +2949 -0
  4. data/app/assets/javascripts/thesis/rangy-core.js +94 -0
  5. data/app/assets/javascripts/thesis/thesis.js.coffee +157 -0
  6. data/app/assets/javascripts/thesis.js +3 -0
  7. data/app/assets/stylesheets/thesis/font/FontAwesome.otf +0 -0
  8. data/app/assets/stylesheets/thesis/font/fontawesome-webfont.eot +0 -0
  9. data/app/assets/stylesheets/thesis/font/fontawesome-webfont.svg +284 -0
  10. data/app/assets/stylesheets/thesis/font/fontawesome-webfont.ttf +0 -0
  11. data/app/assets/stylesheets/thesis/font/fontawesome-webfont.woff +0 -0
  12. data/app/assets/stylesheets/thesis/font-awesome/font-awesome.scss +534 -0
  13. data/app/assets/stylesheets/thesis/jquery-ui/images/animated-overlay.gif +0 -0
  14. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_flat_30_cccccc_40x100.png +0 -0
  15. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
  16. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_20_555555_1x400.png +0 -0
  17. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_40_0078a3_1x400.png +0 -0
  18. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_40_ffc73d_1x400.png +0 -0
  19. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
  20. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
  21. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_inset-soft_25_000000_1x100.png +0 -0
  22. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
  23. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  24. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_4b8e0b_256x240.png +0 -0
  25. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_a83300_256x240.png +0 -0
  26. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_cccccc_256x240.png +0 -0
  27. data/app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  28. data/app/assets/stylesheets/thesis/jquery-ui/jquery-ui-1.10.2.custom.css +1175 -0
  29. data/app/assets/stylesheets/thesis/thesis.css.scss +65 -0
  30. data/app/assets/stylesheets/thesis.css +4 -0
  31. data/config/routes.rb +3 -0
  32. data/lib/thesis/controllers/controller_helpers.rb +4 -2
  33. data/lib/thesis/controllers/thesis_controller.rb +8 -2
  34. data/lib/thesis/models/page.rb +3 -3
  35. data/lib/thesis/routing/route_constraint.rb +2 -1
  36. data/lib/thesis/routing/routes.rb +12 -0
  37. data/lib/thesis/version.rb +1 -1
  38. data/lib/thesis.rb +2 -3
  39. metadata +32 -1
@@ -0,0 +1,65 @@
1
+ #thesis-editor {
2
+ display: block;
3
+ position:absolute;
4
+ right: 10px;
5
+ top: 10px;
6
+ width:54px;
7
+ z-index: 1040;
8
+
9
+ & #thesis-edit-page {
10
+ background-color:rgba(0, 0, 0, 0.6);
11
+ color:#ECECEC;
12
+ display:block;
13
+ font-size: 20px;
14
+ padding:10px;
15
+ line-height: 20px;
16
+ border-radius: 8px;
17
+ box-shadow: 0 0 10px #444;
18
+ -webkit-transition: 0.5s;
19
+ text-decoration: none;
20
+ width: 34px;
21
+
22
+ &:hover {
23
+ box-shadow: 0 0 20px #000;
24
+ -webkit-transition: 0.5s;
25
+ }
26
+ & i {
27
+ display: none;
28
+ }
29
+ & i:first-child {
30
+ display: block;
31
+ }
32
+ }
33
+
34
+ }
35
+
36
+ body.thesis-editing {
37
+ & .thesis-content {
38
+ z-index: 1039;
39
+ box-shadow: 0 0 1px 1px rgba(150, 168, 236, 0.8);
40
+ }
41
+ & #thesis-editor {
42
+ & #thesis-edit-page {
43
+ & i {
44
+ display: block;
45
+ }
46
+ & i:first-child {
47
+ display: none;
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ .fader {
54
+ top: 0px;
55
+ left: 0px;
56
+ width: 100%;
57
+ height: 100%;
58
+ position: fixed;
59
+ background-color: rgb(29, 49, 58);
60
+ opacity: 0.1;
61
+ cursor: crosshair;
62
+ z-index: 1038;
63
+ display: block;
64
+ pointer-events: none;
65
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require_self
3
+ *= require_tree .
4
+ */
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ thesis_routes
3
+ end
@@ -1,11 +1,13 @@
1
1
  module Thesis
2
2
  module ControllerHelpers
3
3
  def current_page
4
- @current_page ||= Page.where(slug: request.fullpath).first
4
+ slug = request.fullpath.sub(/(\/)+$/,'')
5
+ @current_page ||= Page.where(slug: slug).first
6
+ @current_page
5
7
  end
6
8
 
7
9
  def root_pages
8
- @root_pages ||= Page.where(parent_id: nil).order("sort_order ASC").all
10
+ @root_pages ||= Page.where(parent_id: nil).order("sort_order ASC")
9
11
  end
10
12
 
11
13
  def thesis_editor
@@ -4,7 +4,7 @@ module Thesis
4
4
 
5
5
  def show
6
6
  raise ActionController::RoutingError.new('Not Found') unless current_page
7
-
7
+
8
8
  if current_page.template && template_exists?("page_templates/#{current_page.template}")
9
9
  render "page_templates/#{current_page.template}", layout: false
10
10
  else
@@ -17,6 +17,11 @@ module Thesis
17
17
  return head :forbidden unless page_is_editable?(page)
18
18
 
19
19
  update_page_attributes page
20
+ if params[:parent_slug].present?
21
+ parent_slug = params[:parent_slug].to_s.sub(/(\/)+$/,'')
22
+ parent = Page.where(slug: parent_slug).first
23
+ page.parent = parent
24
+ end
20
25
 
21
26
  resp = {}
22
27
 
@@ -30,7 +35,8 @@ module Thesis
30
35
  end
31
36
 
32
37
  def delete_page
33
- page = Page.where(slug: params[:slug].to_s).first
38
+ slug = params[:slug].to_s.sub(/(\/)+$/,'')
39
+ page = Page.where(slug: slug).first
34
40
  return head :forbidden unless page && page_is_editable?(page)
35
41
 
36
42
  head page.destroy ? :ok : :not_acceptable
@@ -37,11 +37,11 @@ module Thesis
37
37
 
38
38
  def find_or_create_page_content(name, content_type, opts = {})
39
39
  page_content = self.page_contents.where(name: name).first_or_create do |pc|
40
- pc.content = "<p>Edit This HTML Area</p>" if content_type == :html
41
- pc.content = "Edit This Text Area" if content_type == :text
40
+ pc.content = opts[:default] || "<p>Edit This HTML Area</p>" if content_type == :html
41
+ pc.content = opts[:default] || "Edit This Text Area" if content_type == :text
42
42
  width = opts[:width] || 350
43
43
  height = opts[:height] || 150
44
- pc.content = "http://placehold.it/#{width}x#{height}" if content_type == :image
44
+ pc.content = opts[:default] || "http://placehold.it/#{width}x#{height}" if content_type == :image
45
45
  end
46
46
  page_content.content_type = content_type
47
47
  page_content.save if page_content.changed?
@@ -1,7 +1,8 @@
1
1
  module Thesis
2
2
  class RouteConstraint
3
3
  def self.matches?(request)
4
- Page.where(slug: request.path.to_s).select("id").first.present?
4
+ slug = request.path.to_s.sub(/(\/)+$/,'')
5
+ Page.where(slug: slug).select("id").first.present?
5
6
  end
6
7
  end
7
8
  end
@@ -0,0 +1,12 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+ def thesis_routes
4
+ put "thesis/update_page_content" => "thesis/thesis#update_page_content"
5
+ post "thesis/create_page" => "thesis/thesis#create_page"
6
+ delete "thesis/delete_page" => "thesis/thesis#delete_page"
7
+
8
+ get "*slug" => 'thesis/thesis#show', constraints: ::Thesis::RouteConstraint
9
+ end
10
+ end
11
+ end
12
+
@@ -1,3 +1,3 @@
1
1
  module Thesis
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/thesis.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  require "thesis/version"
2
2
  require "thesis/exceptions"
3
3
  require "thesis/controllers/controller_helpers"
4
+ require "thesis/routing/routes"
4
5
  require "thesis/routing/route_constraint"
5
- require "thesis/engine"
6
-
7
- # Models
8
6
  require "thesis/models/page"
9
7
  require "thesis/models/page_content"
8
+ require "thesis/engine"
10
9
 
11
10
  module Thesis
12
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thesis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,9 +50,40 @@ files:
50
50
  - lib/thesis/models/page_content.rb
51
51
  - lib/thesis/railtie.rb
52
52
  - lib/thesis/routing/route_constraint.rb
53
+ - lib/thesis/routing/routes.rb
53
54
  - lib/thesis/version.rb
54
55
  - lib/thesis.rb
56
+ - app/assets/javascripts/thesis/hallo.js
57
+ - app/assets/javascripts/thesis/rangy-core.js
58
+ - app/assets/javascripts/thesis/thesis.js.coffee
59
+ - app/assets/javascripts/thesis.js
60
+ - app/assets/stylesheets/thesis/font/fontawesome-webfont.eot
61
+ - app/assets/stylesheets/thesis/font/fontawesome-webfont.svg
62
+ - app/assets/stylesheets/thesis/font/fontawesome-webfont.ttf
63
+ - app/assets/stylesheets/thesis/font/fontawesome-webfont.woff
64
+ - app/assets/stylesheets/thesis/font/FontAwesome.otf
65
+ - app/assets/stylesheets/thesis/font-awesome/font-awesome.scss
66
+ - app/assets/stylesheets/thesis/jquery-ui/images/animated-overlay.gif
67
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_flat_30_cccccc_40x100.png
68
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_flat_50_5c5c5c_40x100.png
69
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_20_555555_1x400.png
70
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_40_0078a3_1x400.png
71
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_glass_40_ffc73d_1x400.png
72
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_gloss-wave_25_333333_500x100.png
73
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_highlight-soft_80_eeeeee_1x100.png
74
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_inset-soft_25_000000_1x100.png
75
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-bg_inset-soft_30_f58400_1x100.png
76
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_222222_256x240.png
77
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_4b8e0b_256x240.png
78
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_a83300_256x240.png
79
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_cccccc_256x240.png
80
+ - app/assets/stylesheets/thesis/jquery-ui/images/ui-icons_ffffff_256x240.png
81
+ - app/assets/stylesheets/thesis/jquery-ui/jquery-ui-1.10.2.custom.css
82
+ - app/assets/stylesheets/thesis/thesis.css.scss
83
+ - app/assets/stylesheets/thesis.css
84
+ - config/routes.rb
55
85
  - README.md
86
+ - LICENSE.txt
56
87
  - spec/factories/page_contents.rb
57
88
  - spec/factories/pages.rb
58
89
  - spec/lib/thesis/controllers/thesis_controller_spec.rb