diff options
| author | mo <mo.khan@gmail.com> | 2017-09-03 15:16:43 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2017-09-03 15:16:43 -0600 |
| commit | dceee11f9b6b2a1d8ce151a94743f765d4f72b5a (patch) | |
| tree | f12fc6dccedb47ae5fb6a413275f55665beeffeb /app | |
| parent | 2fe8923b80b89f336c960d59c267776235ef91e5 (diff) | |
remove disqus
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/javascripts/cakeside.js.coffee | 5 | ||||
| -rw-r--r-- | app/assets/javascripts/views/disqus_view.js.coffee | 32 | ||||
| -rw-r--r-- | app/assets/javascripts/views/my/profiles/show_view.js.coffee | 5 | ||||
| -rw-r--r-- | app/controllers/comments_controller.rb | 17 | ||||
| -rw-r--r-- | app/helpers/application_helper.rb | 9 | ||||
| -rw-r--r-- | app/views/cakes/show.html.erb | 2 | ||||
| -rw-r--r-- | app/views/my/kitchens/show.html.erb | 12 | ||||
| -rw-r--r-- | app/views/shared/_disqus.html.erb | 21 |
8 files changed, 1 insertions, 102 deletions
diff --git a/app/assets/javascripts/cakeside.js.coffee b/app/assets/javascripts/cakeside.js.coffee index 1b8dae24..bd4afe78 100644 --- a/app/assets/javascripts/cakeside.js.coffee +++ b/app/assets/javascripts/cakeside.js.coffee @@ -21,7 +21,6 @@ window.CakeSide = CakeSide.Application = new Marionette.Application() CakeSide.Application.addRegions content_region: '#backbone-content' - comment_region: '#disqus_thread' CakeSide.Application.addInitializer (options) -> new CakeSide.Routers.CakesRouter @@ -41,10 +40,6 @@ window.CakeSide = @categories = new CakeSide.Collections.CategoriesCollection() @tutorials = new CakeSide.Collections.TutorialsCollection() - #@disqus_view = new CakeSide.Views.DisqusView - #disqus_shortname: data.disqus_shortname - #CakeSide.Application.reqres.setHandler 'CommentView', => - #@disqus_view CakeSide.Application.reqres.setHandler 'CakesRepository', => @cakes CakeSide.Application.reqres.setHandler 'CategoriesRepository', => diff --git a/app/assets/javascripts/views/disqus_view.js.coffee b/app/assets/javascripts/views/disqus_view.js.coffee deleted file mode 100644 index 1379691a..00000000 --- a/app/assets/javascripts/views/disqus_view.js.coffee +++ /dev/null @@ -1,32 +0,0 @@ -class CakeSide.Views.DisqusView extends Backbone.View - el: "#disqus_thread" - initialize: (options) -> - disqus = document.createElement('script') - disqus.type = 'text/javascript' - disqus.async = true - disqus.src = "//#{options.disqus_shortname}.disqus.com/embed.js" - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(disqus) - - render: (options) -> - try - @$el.removeClass('hidden') - that = @ - DISQUS.reset - reload: true, - config: -> - @page.identifier = options.identifier - @page.title = "CakeSide - #{options.title}" - @page.url = options.url - @callbacks.onNewComment = [that.saveComment] - @ - catch error - console.log(error) - finally - @ - - hide: -> - @$el.addClass('hidden') - - saveComment: (comment) -> - $.post Routes.comments_path(), { id: comment.id, url: document.URL, comment: comment }, (result) -> - console.log(result) diff --git a/app/assets/javascripts/views/my/profiles/show_view.js.coffee b/app/assets/javascripts/views/my/profiles/show_view.js.coffee index 91076e5e..a7010dc8 100644 --- a/app/assets/javascripts/views/my/profiles/show_view.js.coffee +++ b/app/assets/javascripts/views/my/profiles/show_view.js.coffee @@ -13,7 +13,6 @@ class CakeSide.Views.My.Profiles.ShowView extends Marionette.ItemView modelEvents: 'invalid': 'displayError' - 'sync': 'syncedUp' events: "submit #profile-form": "save" @@ -29,10 +28,6 @@ class CakeSide.Views.My.Profiles.ShowView extends Marionette.ItemView error: @couldNotSave ) - syncedUp: (event) -> - console.log(arguments) - console.log('syncd') - savedSuccessfully: (profile) => @disableSaveButton() @ui.status.removeClass('hide') diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb deleted file mode 100644 index 36c30126..00000000 --- a/app/controllers/comments_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CommentsController < ApplicationController - def create - creation = Creation.find(creation_id) - @comment = current_user.comment_on(creation, comment_params[:text], comment_params[:id]) - render json: @comment - end - - private - - def creation_id - params[:url].match(/\/(\d+)/)[0].gsub("/", "") - end - - def comment_params - params.require(:comment).permit(:id, :text) - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a673e7c5..945a5562 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,15 +13,6 @@ module ApplicationHelper title.blank? ? "CakeSide - for cake lovers!" : "#{title} - CakeSide" end - def disqus_auth(user = current_user) - data = { id: user.id, username: user.name, email: user.email, url: "https://#{request.host_with_port}/profiles/#{user.to_param}" } - data[:avatar] = user.avatar.url_for(:thumb) if user.has_avatar? - message = Base64.encode64(data.to_json).gsub("\n", "") - timestamp = Time.now.to_i - signature = OpenSSL::HMAC.hexdigest('sha1', ENV['DISQUS_SECRET_KEY'] || '', "#{message} #{timestamp}") - "#{message} #{signature} #{timestamp}" - end - def controller?(name) params[:controller].include?(name.to_s) end diff --git a/app/views/cakes/show.html.erb b/app/views/cakes/show.html.erb index 9ffeb94d..8417be73 100644 --- a/app/views/cakes/show.html.erb +++ b/app/views/cakes/show.html.erb @@ -5,5 +5,3 @@ <div id="primary-photo"> <%= render partial: 'show' %> </div> - -<%# render partial: "shared/disqus", locals: { id: "c-#{@creation.id}" } %> diff --git a/app/views/my/kitchens/show.html.erb b/app/views/my/kitchens/show.html.erb index 6946501e..92724690 100644 --- a/app/views/my/kitchens/show.html.erb +++ b/app/views/my/kitchens/show.html.erb @@ -2,16 +2,7 @@ <%= content_for :javascript do -%> <%= javascript_tag do %> var ALL_TAGS = <%= raw @tags.pluck(:name) %>; - var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>'; - var disqus_identifier = 'u-<%= current_user.id %>'; - var disqus_config = function(){ - this.page.remote_auth_s3 = '<%= disqus_auth %>'; - this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>'; - }; - CakeSide.initialize({ - access_token: '<%= current_user.authentication_token %>', - disqus_shortname: disqus_shortname, - }); + CakeSide.initialize({ access_token: '<%= current_user.authentication_token %>' }); <% end %> <% end %> @@ -21,5 +12,4 @@ </div> <div id="backbone-content" class="col-9"></div> </div> -<div id="disqus_thread" class="row"></div> <div id="modal" class="modal hide fade"></div> diff --git a/app/views/shared/_disqus.html.erb b/app/views/shared/_disqus.html.erb deleted file mode 100644 index e3f4def5..00000000 --- a/app/views/shared/_disqus.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<div id="disqus_thread"></div> -<script type="text/javascript"> -var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>'; -var disqus_identifier = '<%= id %>'; -<% if current_user %> - var disqus_config = function(){ - this.page.remote_auth_s3 = '<%= disqus_auth %>'; - this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>'; - this.callbacks.onNewComment = [function(comment) { - $.post('<%= comments_path %>', { id: comment.id, url: document.URL, comment: comment }, function(result){ console.log(result); }); - }]; - }; -<% end %> -(function() { - var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); - })(); -</script> -<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> -<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> |
