From 8d9ec48ff9e67aa2fdd247207052e7660497aaff Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Thu, 4 Dec 2014 22:11:50 +0500 Subject: [PATCH] [#369] project issue page: comments and so on --- .../angular-new/comments/comment.js.coffee | 29 +++++ .../comments/comments_controller.js.coffee | 104 ++++++++++++++++++ .../angular-new/issues/issue.js.coffee | 2 +- .../issues/issue_controller.js.coffee | 9 +- ...coffee.erb => labels_controller.js.coffee} | 0 ...erb => collaborators_controller.js.coffee} | 0 .../projects/comments_controller.rb | 21 ++-- app/presenters/comment_presenter.rb | 16 ++- app/views/projects/comments/_add.html.slim | 28 ++--- app/views/projects/comments/_body.html.slim | 19 ++-- .../projects/comments/_comment.html.haml | 11 -- .../projects/comments/_comment.html.slim | 20 ++++ app/views/projects/comments/_form.html.haml | 2 +- app/views/projects/comments/_list.html.haml | 10 -- app/views/projects/comments/_list.html.slim | 12 ++ .../comments/_markdown_help_body.html.slim | 1 + .../projects/issues/_title_body.html.slim | 2 +- app/views/projects/issues/show.html.slim | 13 ++- .../subscribes/_subscribe_status.html.slim | 15 +++ app/views/shared/_feed_message.html.haml | 29 ----- app/views/shared/_feed_message.html.slim | 30 +++++ config/routes.rb | 4 +- 22 files changed, 271 insertions(+), 106 deletions(-) create mode 100644 app/assets/javascripts/angular-new/comments/comment.js.coffee create mode 100644 app/assets/javascripts/angular-new/comments/comments_controller.js.coffee rename app/assets/javascripts/angular-new/labels/{labels_controller.js.coffee.erb => labels_controller.js.coffee} (100%) rename app/assets/javascripts/angular-new/projects/{collaborators_controller.js.coffee.erb => collaborators_controller.js.coffee} (100%) delete mode 100644 app/views/projects/comments/_comment.html.haml create mode 100644 app/views/projects/comments/_comment.html.slim delete mode 100644 app/views/projects/comments/_list.html.haml create mode 100644 app/views/projects/comments/_list.html.slim create mode 100644 app/views/projects/subscribes/_subscribe_status.html.slim delete mode 100644 app/views/shared/_feed_message.html.haml create mode 100644 app/views/shared/_feed_message.html.slim diff --git a/app/assets/javascripts/angular-new/comments/comment.js.coffee b/app/assets/javascripts/angular-new/comments/comment.js.coffee new file mode 100644 index 000000000..1f2bc4c9b --- /dev/null +++ b/app/assets/javascripts/angular-new/comments/comment.js.coffee @@ -0,0 +1,29 @@ +commentService = ($http) -> + getPath = (kind, project, commentable, id) -> + if commentable.kind is 'issue' + if kind is 'remove' or kind is 'update' + return Routes.project_issue_comment_path(project, commentable.id, id) + else if kind is 'add' + return Routes.project_issue_comments_path(project, commentable.id) + + { + add: (project, commentable, body) -> + path = getPath('add', project, commentable) + params = { comment: { body: body }} + $http.post(path, params) + + update: (project, commentable, id) -> + path = getPath('update', project, commentable, id) + params = { comment: { body: $('#comment-'+id+'-body').val() }} + $http.put(path, params) + + remove: (project, commentable, id) -> + path = getPath('remove', project, commentable, id) + $http.delete(path) + } + +angular + .module("RosaABF") + .factory "Comment", commentService + +commentService.$inject = ['$http'] diff --git a/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee b/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee new file mode 100644 index 000000000..593469b63 --- /dev/null +++ b/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee @@ -0,0 +1,104 @@ +CommentsController = (Comment, Preview, confirmMessage, $compile, $scope) -> + + comments_list = $('#comments_list') + + vm = this + + vm.isDisabledNewCommentButton = -> + vm.processing || vm.new_body is '' || !vm.new_body + + vm.previewBody = (id) -> + if id is 'new-comment' + body = vm.new_body + else + body = $('#'+id+'-body').val() + + if body is '' or !body + vm.preview_body = '' + return false + if body is Preview.old_text + return false + + return false if vm.processing + vm.processing = true + Preview.old_text = '' + + promise = Preview.get_preview(vm.project, body) + promise.success( (response) -> + vm.preview_body = response + Preview.old_text = body + ).error( (response) -> + vm.preview_body = 'Error :(' + ) + + vm.processing = false + false + + vm.toggleEditForm = (id) -> + $('.open-comment').addClass('hidden') + form = $('.open-comment.comment-'+id) + if form.length is 1 + form.removeClass('hidden') + true + else + false + + vm.add = () -> + new_id = null + vm.processing = true + promise = Comment.add(vm.project, vm.commentable, vm.new_body) + promise.then (response) -> + template = angular.element(response.data) + linkFn = $compile(template) + element = linkFn($scope) + comments_list.append(element) + + vm.new_body = '' + new_id = comments_list.find('div.panel.panel-default:last').attr('id') + location.hash = "#" + new_id; + vm.processing = false + + false + + vm.remove = (id) -> + return false unless confirmMessage.show() + vm.processing = true + promise = Comment.remove(vm.project, vm.commentable, id) + promise.then () -> + $('#comment'+id).remove() + vm.processing = false + + false + + vm.update = (id) -> + vm.processing = true + promise = Comment.update(vm.project, vm.commentable, id) + promise.then (response) -> + form = $('#comment'+id+ ' .md_and_cm.cm-s-default').html(response.data.body) + + vm.processing = false + form = $('.open-comment.comment-'+id) + if form.length is 1 + form.addClass('hidden') + return true + else + return false + + vm.init = (project, commentable = {}) -> + vm.project = project + vm.commentable = commentable + vm.processing = false + + true + +angular + .module("RosaABF") + .controller "CommentsController", CommentsController + +CommentsController.$inject = [ + 'Comment' + 'Preview' + 'confirmMessage' + '$compile' + '$scope' + ] diff --git a/app/assets/javascripts/angular-new/issues/issue.js.coffee b/app/assets/javascripts/angular-new/issues/issue.js.coffee index a1f494a00..386666e97 100644 --- a/app/assets/javascripts/angular-new/issues/issue.js.coffee +++ b/app/assets/javascripts/angular-new/issues/issue.js.coffee @@ -4,7 +4,7 @@ issueService = ($http) -> { issue: { title: $('#issue_title').val() - body: $('#issue_body').val() + body: $('#issue-body').val() } } else if kind is 'labels' diff --git a/app/assets/javascripts/angular-new/issues/issue_controller.js.coffee b/app/assets/javascripts/angular-new/issues/issue_controller.js.coffee index 105943b71..0bcda0afc 100644 --- a/app/assets/javascripts/angular-new/issues/issue_controller.js.coffee +++ b/app/assets/javascripts/angular-new/issues/issue_controller.js.coffee @@ -34,19 +34,20 @@ IssueController = (dataservice, $http, Issue, $rootScope, Preview, Label, confir vm = this vm.previewBody = -> - if vm.body is '' or !vm.body + body = $('#issue-body').val() + if body is '' or !body vm.preview_body = '' return false - if vm.body is Preview.old_text + if body is Preview.old_text return false return false if vm.processing vm.processing = true - promise = Preview.get_preview(vm.project, vm.body) + promise = Preview.get_preview(vm.project, body) promise.success( (response) -> vm.preview_body = response - Preview.old_text = vm.body + Preview.old_text = body ).error( (response) -> vm.preview_body = 'Error :(' ) diff --git a/app/assets/javascripts/angular-new/labels/labels_controller.js.coffee.erb b/app/assets/javascripts/angular-new/labels/labels_controller.js.coffee similarity index 100% rename from app/assets/javascripts/angular-new/labels/labels_controller.js.coffee.erb rename to app/assets/javascripts/angular-new/labels/labels_controller.js.coffee diff --git a/app/assets/javascripts/angular-new/projects/collaborators_controller.js.coffee.erb b/app/assets/javascripts/angular-new/projects/collaborators_controller.js.coffee similarity index 100% rename from app/assets/javascripts/angular-new/projects/collaborators_controller.js.coffee.erb rename to app/assets/javascripts/angular-new/projects/collaborators_controller.js.coffee diff --git a/app/controllers/projects/comments_controller.rb b/app/controllers/projects/comments_controller.rb index ce93068fc..1b64caefd 100644 --- a/app/controllers/projects/comments_controller.rb +++ b/app/controllers/projects/comments_controller.rb @@ -8,17 +8,17 @@ class Projects::CommentsController < Projects::BaseController include CommentsHelper def create - anchor = '' if !@comment.set_additional_data params - flash[:error] = I18n.t("flash.comment.save_error") + render online: I18n.t("flash.comment.save_error"), layout: false elsif @comment.save - flash[:notice] = I18n.t("flash.comment.saved") - anchor = view_context.comment_anchor(@comment) + locals = { + comment: @comment, + data: { project: @project, commentable: @commentable } + } + render partial: 'projects/comments/comment', locals: locals, layout: false else - flash[:error] = I18n.t("flash.comment.save_error") - flash[:warning] = @comment.errors.full_messages.join('. ') + render online: I18n.t("flash.comment.save_error"), layout: false end - redirect_to "#{project_commentable_path(@project, @commentable)}##{anchor}" end def edit @@ -28,15 +28,14 @@ class Projects::CommentsController < Projects::BaseController status, message = if @comment.update_attributes(params[:comment]) [200, view_context.markdown(@comment.body)] else - [400, view_context.local_alert(@comment.errors.full_messages.join('. '))] + [422, 'error'] end - render inline: message, status: status + render json: {body: message}, status: status end def destroy @comment.destroy - flash[:notice] = t("flash.comment.destroyed") - redirect_to project_commentable_path(@project, @commentable) + render json: nil end def new_line diff --git a/app/presenters/comment_presenter.rb b/app/presenters/comment_presenter.rb index 80801029e..a45eb2e86 100644 --- a/app/presenters/comment_presenter.rb +++ b/app/presenters/comment_presenter.rb @@ -54,15 +54,21 @@ class CommentPresenter < ApplicationPresenter def buttons project, commentable = options[:project], options[:commentable] - path = helpers.project_commentable_comment_path(project, commentable, comment) - res = [link_to(content_tag(:i, nil, class: 'fa fa-link'), "#{helpers.project_commentable_path(project, commentable)}##{comment_anchor}", class: "#{@options[:in_discussion].present? ? 'in_discussion_' : ''}link_to_comment").html_safe] + link_to_comment = "#{helpers.project_commentable_path(project, commentable)}##{comment_anchor}" + klass = "#{@options[:in_discussion].present? ? 'in_discussion_' : ''}link_to_comment" + res = [ link_to(content_tag(:i, nil, class: 'fa fa-link'), + link_to_comment, + class: klass).html_safe ] if controller.can? :update, @comment - res << link_to(content_tag(:i, nil, class: 'fa fa-edit'), path, id: "comment-#{comment.id}", class: "edit_comment").html_safe + res << link_to(content_tag(:i, nil, class: 'fa fa-edit'), + "#update-comment#{comment.id}", + 'ng-click' => "commentsCtrl.toggleEditForm(#{comment_id})" ).html_safe end if controller.can? :destroy, @comment - res << link_to(content_tag(:i, nil, class: 'fa fa-close'), path, method: "delete", - data: { confirm: t('layout.comments.confirm_delete') }).html_safe + res << link_to(content_tag(:i, nil, class: 'fa fa-close'), + '', + 'ng-click' => "commentsCtrl.remove(#{comment_id})").html_safe end res end diff --git a/app/views/projects/comments/_add.html.slim b/app/views/projects/comments/_add.html.slim index 410cd7a51..df51007ac 100644 --- a/app/views/projects/comments/_add.html.slim +++ b/app/views/projects/comments/_add.html.slim @@ -1,32 +1,20 @@ h3 = t('layout.comments.new_header') -- if Comment.issue_comment?(commentable.class) - - new_path = project_issue_comments_path(project, commentable) - - is_subscribed = commentable.subscribes.exists?(user_id: current_user.id) - - subscribe_path = is_subscribed ? project_issue_subscribe_path(project, commentable, current_user.id) : project_issue_subscribes_path(project, commentable) -- else Comment.commit_comment?(commentable.class) - - new_path = project_commit_comments_path(project, commentable) - - is_subscribed = Subscribe.subscribed_to_commit?(project, current_user, commentable) - - subscribe_path = is_subscribed ? unsubscribe_commit_path(project, commentable) : subscribe_commit_path(project, commentable) -= simple_form_for Comment.new, url: new_path, html: { method: :post } do |f| += simple_form_for Comment.new, url: '', html: { method: :post } do |f| .panel.panel-info ng-controller = 'IssueController as issueCtrl' ng-cloak = true .panel-heading h3.panel-title - - t('activerecord.attributes.issue.body') = f.label :body .pull-right= render 'projects/comments/button_md_help' .panel-body - = render 'projects/comments/body', f: f + = render 'projects/comments/body', f: f, id: 'new-comment', ctrl: 'commentsCtrl', + ang_model: 'commentsCtrl.new_body' hr - = f.button :submit, t('layout.create') + button.btn.btn-primary[ ng-disabled = 'commentsCtrl.isDisabledNewCommentButton()' + ng-click = 'commentsCtrl.add()' ] + = t('layout.create') .panel-footer => t('layout.comments.notifications_are') - - if is_subscribed - span.label.label-success> - = t('layout.turned_on') - = link_to t('layout.commits.unsubscribe_btn'), subscribe_path, method: :delete - - else - span.label.label-danger> - = t('layout.turned_off') - = link_to t('layout.commits.subscribe_btn'), subscribe_path, method: :post + + == render 'projects/subscribes/subscribe_status', project: @project, commentable: @issue diff --git a/app/views/projects/comments/_body.html.slim b/app/views/projects/comments/_body.html.slim index bc49ab930..30df1f228 100644 --- a/app/views/projects/comments/_body.html.slim +++ b/app/views/projects/comments/_body.html.slim @@ -1,13 +1,18 @@ tabset tab heading = t('layout.edit') - .offset10 ng-init="issueCtrl.body = '#{f.object.body}'" - = f.input :body, label: false, - input_html: { rows: 10, ng_model: 'issueCtrl.body' } + .offset10 + - if defined?(ang_model) + = f.input :body, label: false, + input_html: { rows: 10, id: "#{id}-body", + 'ng-model' => ang_model, 'ng-value' => ang_model } + - else + = f.input :body, label: false, + input_html: { rows: 10, id: "#{id}-body" } tab[ heading = t('layout.preview') - select = 'issueCtrl.previewBody()' ] + select = "#{ctrl}.previewBody('#{id}')" ] .offset10 - i.fa.fa-spinner.fa-spin.fa-lg ng-show = 'issueCtrl.processing' + i.fa.fa-spinner.fa-spin.fa-lg ng-show = "#{ctrl}.processing" - div[ ng-bind-html = 'issueCtrl.preview_body' - ng-show = '!issueCtrl.processing' ] + div[ ng-bind-html = "#{ctrl}.preview_body" + ng-show = "!#{ctrl}.processing" ] diff --git a/app/views/projects/comments/_comment.html.haml b/app/views/projects/comments/_comment.html.haml deleted file mode 100644 index 60d87f7bd..000000000 --- a/app/views/projects/comments/_comment.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -- CommentPresenter.present(comment, data) do |presenter| - = render 'shared/feed_message', presenter: presenter --unless comment.automatic - #open-comment.comment.hidden{class: "comment-#{comment.id}"} - =render 'projects/comments/button_md_help' - %h3.tmargin0= t("layout.comments.edit_header") - = simple_form_for comment, url: project_commentable_comment_path(data[:project], data[:commentable], comment), html: { class: 'form edit_comment' } do |f| - = render "projects/comments/form", f: f, id: "#{data[:add_id]}edit_#{comment.id}" - .comment-left - =link_to t('layout.cancel'), '#', id: "comment-#{comment.id}", class: 'cancel_edit_comment button' - .both diff --git a/app/views/projects/comments/_comment.html.slim b/app/views/projects/comments/_comment.html.slim new file mode 100644 index 000000000..1df688f63 --- /dev/null +++ b/app/views/projects/comments/_comment.html.slim @@ -0,0 +1,20 @@ +- CommentPresenter.present(comment, data) do |presenter| + == render 'shared/feed_message', presenter: presenter +-unless comment.automatic + .open-comment.hidden class = "comment-#{comment.id}" id = "update-comment#{comment.id}" + h3.tmargin0= t("layout.comments.edit_header") + = simple_form_for comment, url: project_commentable_comment_path(data[:project], data[:commentable], comment) do |f| + .panel.panel-info + .panel-heading + h3.panel-title + = f.label :body + .pull-right== render 'projects/comments/button_md_help' + .panel-body + == render 'projects/comments/body', f: f, id: "comment-#{comment.id}", + ctrl: 'commentsCtrl' + - anchor = "#comment#{comment.id}" + a.btn.btn-primary[ ng-disabled = 'commentsCtrl.processing' + href = anchor + ng-click = "commentsCtrl.update(#{comment.id})" ] + = t('layout.update') + =< link_to t('layout.cancel'), anchor diff --git a/app/views/projects/comments/_form.html.haml b/app/views/projects/comments/_form.html.haml index 306b7b379..c43a72c96 100644 --- a/app/views/projects/comments/_form.html.haml +++ b/app/views/projects/comments/_form.html.haml @@ -1,2 +1,2 @@ =render 'projects/comments/body', f: f, id: id -.comment-right= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} +/.comment-right= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} diff --git a/app/views/projects/comments/_list.html.haml b/app/views/projects/comments/_list.html.haml deleted file mode 100644 index e3b4ad037..000000000 --- a/app/views/projects/comments/_list.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%a{ name: "comments" } -.hr -%h3#block-list= t("layout.comments.comments_header") -- list.each do |comment| - -unless comment.created_from_commit_hash - = render 'projects/comments/comment', comment: comment, data: {project: project, commentable: commentable} - -else - - GitPresenters::CommitAsMessagePresenter.present(nil, comment: comment) do |presenter| - = render 'shared/feed_message', presenter: presenter, item_no: "-#{comment.id}" -= render "projects/comments/markdown_help" diff --git a/app/views/projects/comments/_list.html.slim b/app/views/projects/comments/_list.html.slim new file mode 100644 index 000000000..fe644d1e0 --- /dev/null +++ b/app/views/projects/comments/_list.html.slim @@ -0,0 +1,12 @@ +a name = 'comments' + +h3#block-list= t("layout.comments.comments_header") +#comments_list + - list.each do |comment| + -unless comment.created_from_commit_hash + == render 'projects/comments/comment', comment: comment, + data: { project: project, commentable: commentable } + -else + - GitPresenters::CommitAsMessagePresenter.present(nil, comment: comment) do |presenter| + == render 'shared/feed_message', presenter: presenter, item_no: "-#{comment.id}" +== render "projects/comments/markdown_help" diff --git a/app/views/projects/comments/_markdown_help_body.html.slim b/app/views/projects/comments/_markdown_help_body.html.slim index bbcebb2ad..946cff090 100644 --- a/app/views/projects/comments/_markdown_help_body.html.slim +++ b/app/views/projects/comments/_markdown_help_body.html.slim @@ -72,6 +72,7 @@ br | without syntax highlighting: br + br | def foo: br | if not bar: diff --git a/app/views/projects/issues/_title_body.html.slim b/app/views/projects/issues/_title_body.html.slim index 6347de23d..acdc1f4c9 100644 --- a/app/views/projects/issues/_title_body.html.slim +++ b/app/views/projects/issues/_title_body.html.slim @@ -7,4 +7,4 @@ = f.label :body .pull-right= render 'projects/comments/button_md_help' .panel-body - = render 'projects/comments/body', f: f + = render 'projects/comments/body', f: f, id: 'issue', ctrl: 'issueCtrl' diff --git a/app/views/projects/issues/show.html.slim b/app/views/projects/issues/show.html.slim index 643c14d5f..63c69ec48 100644 --- a/app/views/projects/issues/show.html.slim +++ b/app/views/projects/issues/show.html.slim @@ -35,10 +35,15 @@ == render 'closed_by' == render 'choose_assignee' - == render "projects/comments/list", list: @issue.comments, project: @project, commentable: @issue - - if current_user - hr - == render "projects/comments/add", project: @project, commentable: @issue if current_user + - params = "{ kind: 'issue', id: #{@issue.serial_id} }" + div[ ng-controller = 'CommentsController as commentsCtrl' + ng-init = "commentsCtrl.init('#{@project.name_with_owner}', #{params})" ] + == render "projects/comments/list", list: @issue.comments, + project: @project, commentable: @issue + - if current_user + hr + == render "projects/comments/add", project: @project, commentable: @issue + .col-md-9.col-sm-8.offset20 ng-show='issueCtrl.edit' h3= t('layout.issues.edit_header') diff --git a/app/views/projects/subscribes/_subscribe_status.html.slim b/app/views/projects/subscribes/_subscribe_status.html.slim new file mode 100644 index 000000000..76fbc8f84 --- /dev/null +++ b/app/views/projects/subscribes/_subscribe_status.html.slim @@ -0,0 +1,15 @@ +- if Comment.issue_comment?(commentable.class) + - is_subscribed = commentable.subscribes.exists?(user_id: current_user.id) + - subscribe_path = is_subscribed ? project_issue_subscribe_path(project, commentable, current_user.id) : project_issue_subscribes_path(project, commentable) +- else Comment.commit_comment?(commentable.class) + - is_subscribed = Subscribe.subscribed_to_commit?(project, current_user, commentable) + - subscribe_path = is_subscribed ? unsubscribe_commit_path(project, commentable) : subscribe_commit_path(project, commentable) + +- if is_subscribed + span.label.label-success> + = t('layout.turned_on') + = link_to t('layout.commits.unsubscribe_btn'), subscribe_path, method: :delete +- else + span.label.label-danger> + = t('layout.turned_off') + = link_to t('layout.commits.subscribe_btn'), subscribe_path, method: :post diff --git a/app/views/shared/_feed_message.html.haml b/app/views/shared/_feed_message.html.haml deleted file mode 100644 index 63e2650ae..000000000 --- a/app/views/shared/_feed_message.html.haml +++ /dev/null @@ -1,29 +0,0 @@ --if !presenter.is_reference_to_issue || can?(:show, presenter.reference_project) - .panel.panel-default{id: presenter.comment_id? ? presenter.comment_anchor : ''} - .panel-body - .pull-left.roffset5 - %img{ alt: 'avatar', src: presenter.image } - .pull-left - %strong= presenter.header - - if presenter.buttons? - %span.pull-right -   - = raw presenter.buttons.join(' ').html_safe - - = "(#{datetime_moment(presenter.date, tag: :strong)})".html_safe - - if presenter.caption? - .clearfix - %span= presenter.caption - - if presenter.expandable? and presenter.content? - %span.data-expander.collapsed{id: "expand#{item_no}"}   - - .clearfix - - if presenter.content? - %div - =presenter.issue_referenced_state if presenter.issue_referenced_state? - .fulltext{class: "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}", - id: presenter.expandable? ? "content-expand#{item_no}" : ''} - .md_and_cm{class: presenter.is_reference_to_issue ? '' : 'cm-s-default'} - = preserve do - = presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content) - .clearfix diff --git a/app/views/shared/_feed_message.html.slim b/app/views/shared/_feed_message.html.slim new file mode 100644 index 000000000..47b087b85 --- /dev/null +++ b/app/views/shared/_feed_message.html.slim @@ -0,0 +1,30 @@ +-if !presenter.is_reference_to_issue || can?(:show, presenter.reference_project) + .panel.panel-default[ id = (presenter.comment_id? ? presenter.comment_anchor : '') ] + .panel-body + .pull-left.roffset5 + img alt = 'avatar' src = presenter.image + + - if presenter.buttons? + .pull-right + |   + = raw presenter.buttons.join(' ').html_safe + + .pull-left + strong= presenter.header + p= datetime_moment(presenter.date, tag: :strong) + + - if presenter.caption? + .clearfix + span= presenter.caption + - if presenter.expandable? and presenter.content? + span.data-expander.collapsed[ id = "expand#{item_no}"]   + + .clearfix + - if presenter.content? + .offset10 + =presenter.issue_referenced_state if presenter.issue_referenced_state? + .fulltext[ class = "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}" + id = (presenter.expandable? ? "content-expand#{item_no}" : '') ] + .md_and_cm[ class = (presenter.is_reference_to_issue ? '' : 'cm-s-default') ] + = presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content) + .clearfix diff --git a/config/routes.rb b/config/routes.rb index 76bc65c5a..6dd601cb5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -328,8 +328,8 @@ Rosa::Application.routes.draw do end end - get 'pull_requests' => 'issues#pull_requests', as: :pull_requests - get 'labels' => 'issues#labels', as: :labels + get 'pull_requests' => 'issues#pull_requests', as: :pull_requests + get 'labels' => 'issues#labels', as: :labels post 'labels/:label_id' => 'issues#destroy_label', as: :issues_delete_label post 'labels/:label_id/update' => 'issues#update_label', as: :issues_update_label