pullentity-client 0.3.5 → 0.3.6

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 (33) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.md +2 -13
  3. data/lib/pullentity-client/templates/app/assets/javascripts/application.js.erb +2 -0
  4. data/lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss +1 -3
  5. data/lib/pullentity-client/templates/app/views/list.haml +12 -11
  6. data/lib/pullentity-client/templates/app/views/shared/head.haml +4 -1
  7. data/lib/pullentity-client/templates/app/views/shared/js.haml +1 -31
  8. data/lib/pullentity-client/templates/app/views/themes/list-2.haml +10 -9
  9. data/lib/pullentity-client/templates/app/views/themes/theme-1.haml +24 -0
  10. data/lib/pullentity-client/templates/defaults/Gemfile.erb +1 -1
  11. data/lib/pullentity-client/version.rb +1 -1
  12. data/vendor/assets/.DS_Store +0 -0
  13. data/vendor/assets/javascripts/{backbone/.DS_Store → .DS_Store} +0 -0
  14. data/vendor/assets/javascripts/jquery.livequery.js +226 -0
  15. data/vendor/assets/stylesheets/.DS_Store +0 -0
  16. metadata +48 -22
  17. checksums.yaml +0 -15
  18. data/lib/pullentity-client/templates/app/views/themes/theme1.haml +0 -23
  19. data/vendor/assets/javascripts/backbone/backbone.js +0 -1571
  20. data/vendor/assets/javascripts/backbone/underscore.js +0 -1227
  21. data/vendor/assets/javascripts/handlebars.js +0 -2278
  22. data/vendor/assets/javascripts/pullentity-backbone/.DS_Store +0 -0
  23. data/vendor/assets/javascripts/pullentity-backbone/app/helpers/app_helper.js.coffee +0 -13
  24. data/vendor/assets/javascripts/pullentity-backbone/app/models/project.js.coffee +0 -11
  25. data/vendor/assets/javascripts/pullentity-backbone/app/models/section.js.coffee +0 -13
  26. data/vendor/assets/javascripts/pullentity-backbone/app/models/site.js.coffee +0 -7
  27. data/vendor/assets/javascripts/pullentity-backbone/app/routers/router.coffee +0 -7
  28. data/vendor/assets/javascripts/pullentity-backbone/app/site.js.coffee +0 -40
  29. data/vendor/assets/javascripts/pullentity-backbone/app/views/main.js.coffee +0 -155
  30. data/vendor/assets/javascripts/pullentity-backbone/application.js.coffee +0 -8
  31. data/vendor/assets/javascripts/pullentity.js +0 -3
  32. data/vendor/assets/stylesheets/pullentity.css.scss.erb +0 -0
  33. data/vendor/assets/stylesheets/pullentity/themes/default.css.scss +0 -0
@@ -1,13 +0,0 @@
1
- Handlebars.registerHelper 'SectionUrl', (section)->
2
- "/#sections/#{section.id}"
3
-
4
- Handlebars.registerHelper 'ProjectUrl', (project)->
5
- "/#projects/#{project.id}"
6
-
7
- Handlebars.registerHelper 'ProjectImg', (version)->
8
- v = version ? version : "url"
9
- return if _.isEmpty(@photos[0])
10
- @photos[0].image.image[v].url
11
-
12
- Handlebars.registerHelper 'PhotoImg', (version)->
13
- @image.image[version].url
@@ -1,11 +0,0 @@
1
- class Pullentity.Models.Project extends Backbone.Model
2
-
3
- class Pullentity.Collections.Projects extends Backbone.Collection
4
-
5
- model: Pullentity.Models.Project
6
-
7
- url : ()->
8
- if @id
9
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/site/projects/#{@id}"
10
- else
11
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/site/projects"
@@ -1,13 +0,0 @@
1
- class Pullentity.Models.Section extends Backbone.Model
2
-
3
-
4
- class Pullentity.Collections.Sections extends Backbone.Collection
5
-
6
- model: Pullentity.Models.Section
7
-
8
- url : ()->
9
- if @id
10
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/site/sections/#{@id}"
11
- else
12
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/site/sections"
13
-
@@ -1,7 +0,0 @@
1
- class Pullentity.Models.Site extends Backbone.Model
2
- url : ()->
3
- if @id
4
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/site"
5
- else
6
- "#{Pullentity.Domain}.#{Pullentity.host}/api/v1/sites"
7
-
@@ -1,7 +0,0 @@
1
- class Pullentity.Routers.main extends Backbone.Router
2
- routes:
3
- "sections/:id" : "getSection"
4
- "projects/:id" : "getProject"
5
- "*actions": "defaultRoute" # matches http://example.com/#anything-here - See more at: http://backbonetutorials.com/what-is-a-router/
6
-
7
-
@@ -1,40 +0,0 @@
1
- #= require_self
2
- #= require_tree ./helpers
3
- # require_tree ../templates
4
- #= require_tree ./models
5
- #= require_tree ./views
6
- #= require_tree ./routers
7
-
8
- unless window.console
9
- console =
10
- log: ->
11
- alert: ->
12
- info: ->
13
-
14
- if _.isUndefined window.pullentity_domain
15
- alert("Please configure the domain name in pullentity.yml file or run pullentity auth login")
16
- false
17
-
18
- window.Pullentity =
19
- Domain: window.pullentity_domain
20
- host: "pullentity.com" # "pullentity.dev:3000" #
21
- Models: {}
22
- Collections: {}
23
- Routers: {}
24
- Views: {
25
- Commons: {}
26
- }
27
-
28
- Helpers:
29
- BootstrapHelpers: {}
30
-
31
- #if !Backbone.history.started
32
- # Backbone.history.start()
33
- # Backbone.history.started = true
34
-
35
-
36
-
37
-
38
-
39
-
40
-
@@ -1,155 +0,0 @@
1
- class Pullentity.Views.Commons.Main extends Backbone.View
2
- el: "body"
3
-
4
- events:
5
- "click": "hideSuggests"
6
-
7
- initialize: ->
8
-
9
- #console.info "pullentity LOADED!!!"
10
- @site = new Pullentity.Models.Site(id: "michelsongs")
11
- @site.on("change", @initModels )
12
- @site.fetch()
13
-
14
- initModels: ()=>
15
- #console.log("init models")
16
- @sections = new Pullentity.Collections.Sections(@site.get('sections'))
17
- @projects = new Pullentity.Collections.Projects(@site.get('projects'))
18
- #debugger
19
- #console.log("Site Loaded!")
20
- #console.log @sections
21
- #console.log @projects
22
- @setTitle()
23
-
24
- @render()
25
-
26
- @setupLinks()
27
-
28
- # quizas cargar router acá
29
-
30
- setTitle: ()=>
31
- #console.log @site.get("name")
32
- document.title = "#{@site.get("name")} pullentity site"
33
-
34
- initRouter: ()=>
35
- @app_router = new Pullentity.Routers.main
36
-
37
- @app_router.on 'route:defaultRoute', (actions)=>
38
- #console.log(actions) # See more at: http://backbonetutorials.com/what-is-a-router
39
- #console.log("init routes")
40
- @render_home_project()
41
-
42
- @app_router.on 'route:getProject', (id)=>
43
- #console.log("get project #{id}")
44
- @find_project_by_id(id)
45
-
46
- @app_router.on 'route:getSection', (id)=>
47
- #console.log("get section #{id}")
48
- @find_in_section(id)
49
-
50
- Backbone.history.start(pushState: true)
51
-
52
- render: ()=>
53
- #console.info("should render layout")
54
- source = $("#layout").html()
55
- @theme_templates = $(".pullentity-themes")
56
- @layout = Handlebars.compile(source)
57
- #console.log(@site.attributes)
58
- $("body").html(@layout(@site.attributes))
59
- @initRouter()
60
-
61
- render_home_project: ()=>
62
- @current_project = @projects.findWhere({home: true })
63
- @find_theme_for_project()
64
- @render_project()
65
-
66
- find_project_by_id: (id)=>
67
- @current_project = @projects.findWhere({id: parseInt(id) })
68
- @find_theme_for_project()
69
- @render_project()
70
-
71
- find_in_section: (id)=>
72
- @current_section = @sections.findWhere({ id: parseInt(id) })
73
- @render_project_or_list(id)
74
-
75
- render_project_or_list: (id)=>
76
- switch @current_section.get("list_or_project")
77
- when "project" then @render_project_theme()
78
- when "list" then @render_list()
79
-
80
- render_project_theme: ()=>
81
- @current_project = @projects.findWhere(section_id: @current_section.id )
82
- @find_theme_for_project()
83
- @render_project()
84
-
85
- render_list: ()=>
86
-
87
- #si tiene theme para la lista
88
- if @theme_list = @current_section.get("theme_template")
89
- @current_theme_obj = @find_theme_for_list()
90
- else
91
- @current_theme_obj = _.find @theme_templates, (num)=>
92
- if $(num).attr("id") == "list"
93
- num
94
-
95
- @find_projects_for_list(@current_section)
96
- @render_handlebars()
97
- $("#content").html(@current_template({section: @current_section.attributes, projects: @list_projects }))
98
-
99
- render_project: ()=>
100
- @render_handlebars()
101
- $("#content").html(@current_template(@current_project.attributes))
102
-
103
- find_theme_for_project: ()=>
104
- @current_theme_obj = _.find @theme_templates, (num)=>
105
- if $(num).attr("id") == @current_project.get("theme_template").name
106
- num
107
- console.error "theme \"#{@current_project.get("theme_template").name}\" does not exist" unless @current_theme_obj
108
-
109
- find_theme_for_list: ()=>
110
- #console.log("list with theme!")
111
- name = @current_section.get("theme_template").name
112
- theme = _.find @theme_templates, (num)=>
113
- if $(num).attr("id") == name
114
- num
115
- theme ? theme : @render_with_error(name)
116
-
117
- find_projects_for_list: (section)=>
118
- @list_projects = _.filter @projects.toJSON(), (num)=>
119
- if num.section.public_url == section.get("public_url")
120
- num
121
-
122
- render_with_error: (name)=>
123
- $("#content").html("<pre>Couldn´t find template #{name} in /source/views/themes</pre>")
124
- console.warn "Couldn´t find projects in #{name} yet"
125
-
126
- render_handlebars: ()=>
127
- try
128
- @current_template = Handlebars.compile($(@current_theme_obj).html())
129
- catch e
130
- #console.error "error while creating Handlebars script out of template for [", $(@current_theme_obj), e
131
- throw e
132
-
133
- setupLinks: ()=>
134
- # Globally capture clicks. If they are internal and not in the pass
135
- # through list, route them through Backbone's navigate method.
136
- $(document).on "click", "a[href^='/']", (event) =>
137
-
138
- href = $(event.currentTarget).attr('href')
139
-
140
- # chain 'or's for other black list routes
141
- passThrough = href.indexOf('sign_out') >= 0
142
-
143
- # Allow shift+click for new tabs, etc.
144
- if !passThrough && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey
145
- event.preventDefault()
146
-
147
- # Remove leading slashes and hash bangs (backward compatablility)
148
- url = href.replace(/^\//,'').replace('\#\/','')
149
-
150
- # Instruct Backbone to trigger routing events
151
- @app_router.navigate url, { trigger: true }
152
-
153
- return false
154
-
155
- layout = new Pullentity.Views.Commons.Main
@@ -1,8 +0,0 @@
1
-
2
- #= require "bootstrap.min"
3
-
4
- #= require "handlebars"
5
- #= require "backbone/underscore"
6
- #= require "backbone/backbone"
7
-
8
- #= require "./app/site"
@@ -1,3 +0,0 @@
1
-
2
- //= require "./pullentity-backbone/application"
3
-
File without changes