[#369] new issue title
This commit is contained in:
parent
0124b9bb10
commit
40cdd40acf
|
@ -13,6 +13,7 @@ issueService = ($http) ->
|
|||
|
||||
path = Routes.project_issues_path(project, params)
|
||||
$http.get(path)
|
||||
|
||||
}
|
||||
|
||||
angular
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
IssueController = (dataservice, $http, Issue, $rootScope, Preview) ->
|
||||
|
||||
vm = this
|
||||
|
||||
vm.previewBody = ->
|
||||
if vm.body is '' or !vm.body
|
||||
vm.preview_body = ''
|
||||
return false
|
||||
if vm.body is Preview.old_text
|
||||
return false
|
||||
|
||||
vm.processing = true
|
||||
|
||||
promise = Preview.get_preview(vm.project, vm.body)
|
||||
promise.success( (response) ->
|
||||
vm.preview_body = response
|
||||
Preview.old_text = vm.body
|
||||
).error( (response) ->
|
||||
vm.preview_body = 'Error :('
|
||||
)
|
||||
|
||||
vm.processing = false
|
||||
false
|
||||
|
||||
init = (dataservice) ->
|
||||
vm.project = dataservice.project
|
||||
vm.labels = dataservice.labels
|
||||
vm.processing = false
|
||||
|
||||
init(dataservice)
|
||||
true
|
||||
|
||||
angular
|
||||
.module("RosaABF")
|
||||
.controller "IssueController", IssueController
|
||||
|
||||
IssueController.$inject = ['IssueInitializer', '$http', 'Issue', '$rootScope', 'Preview']
|
|
@ -0,0 +1,21 @@
|
|||
previewService = ($http) ->
|
||||
old_text = ''
|
||||
{
|
||||
old_text: old_text
|
||||
get_preview: (name_with_owner, text, old_text) ->
|
||||
return null if text is old_text
|
||||
path = Routes.project_md_preview_path(
|
||||
{
|
||||
name_with_owner: name_with_owner,
|
||||
text: text
|
||||
}
|
||||
)
|
||||
$http.post(path)
|
||||
|
||||
}
|
||||
|
||||
angular
|
||||
.module("RosaABF")
|
||||
.factory "Preview", previewService
|
||||
|
||||
previewService.$inject = ['$http']
|
|
@ -160,7 +160,7 @@ class Projects::ProjectsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def preview
|
||||
render inline: view_context.markdown(params[:text] || ''), layout: false
|
||||
render inline: view_context.markdown(params[:text]), layout: false
|
||||
end
|
||||
|
||||
def refs_list
|
||||
|
|
|
@ -31,6 +31,7 @@ module GitlabMarkdownHelper
|
|||
end
|
||||
|
||||
def markdown(text)
|
||||
return '' if text.blank?
|
||||
unless @markdown
|
||||
gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
|
||||
# see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
%ul.nav.nav-tabs#md_tabs
|
||||
%li
|
||||
%a{"data-toggle" => "tab", href: "##{id}_edit"}=t 'layout.edit'
|
||||
%li
|
||||
%a{"data-toggle" => "tab", href: "##{id}_preview"}=t 'layout.preview'
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active{id: "#{id}_edit"}
|
||||
=f.text_area :body, cols: 80, id: "#{id}_edit_input"
|
||||
=hidden_field_tag :body_dup, nil, name: 'text', id: "#{id}_edit_input_dup"
|
||||
.tab-pane{id: "#{id}_preview"}
|
||||
.formatted.cm-s-default.md_and_cm
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
tabset
|
||||
tab heading = t('layout.edit')
|
||||
.offset10
|
||||
= f.input_field :body,
|
||||
class: 'form-control',
|
||||
rows: 10,
|
||||
'ng-model' => 'issueCtrl.body'
|
||||
|
||||
tab[ heading = t('layout.preview')
|
||||
select = 'issueCtrl.previewBody()' ]
|
||||
.offset10
|
||||
i.fa.fa-spinner.fa-spin.fa-lg ng-show = 'issueCtrl.processing'
|
||||
|
||||
div[ ng-bind-html = 'issueCtrl.preview_body'
|
||||
ng-show = '!issueCtrl.processing' ]
|
|
@ -1,2 +0,0 @@
|
|||
=link_to t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal', style: 'float:right;'
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
a[ href = '#' data-toggle = 'modal' data-target = '#md_help' ]
|
||||
= t('layout.comments.md_cheatsheet_header')
|
|
@ -1,93 +1,12 @@
|
|||
#md_help.modal.hidden
|
||||
.modal.fade{ id: 'md_help', tabindex: '-1', role: 'dialog',
|
||||
'aria-labelledby' => 'md_helpLabel', 'aria-hidden' => 'true' }
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "modal", type: "button"} ×
|
||||
%h3#myModalLabel=t('layout.comments.md_cheatsheet_header')
|
||||
%button{ class: 'close', type: 'button', 'data-dismiss' => 'modal' }
|
||||
%span{ 'aria-hidden' => 'true' } ×
|
||||
%span.sr-only Close
|
||||
%h4.modal-title#md_help= t('layout.comments.md_cheatsheet_header')
|
||||
.modal-body
|
||||
.mod
|
||||
.col
|
||||
%h3=t 'layout.comments.md_cheatsheet.format_text'
|
||||
%p=t 'layout.comments.md_cheatsheet.headers'
|
||||
%pre
|
||||
-[1, 3, 6].each do |i|
|
||||
="#{'#'*i} This is an <h#{i}> tag"
|
||||
%p=t 'layout.comments.md_cheatsheet.text_styles'
|
||||
%pre
|
||||
:preserve
|
||||
*This text will be italic*
|
||||
_This will also be italic_
|
||||
**This text will be bold**
|
||||
__This will also be bold__
|
||||
%p=link_to t('layout.comments.md_cheatsheet.emoji_header'), 'http://www.emoji-cheat-sheet.com/', target: '_blank'
|
||||
%pre
|
||||
=":smile:"
|
||||
=image_tag("/images/emoji/#{Emoji.find_by_alias('smile').image_filename}",
|
||||
class: 'emoji', title: 'smile', alt: 'smile', size: "20x20")
|
||||
=" :+1:"
|
||||
=image_tag("/images/emoji/#{Emoji.find_by_alias('+1').image_filename}",
|
||||
class: 'emoji', title: '+1', alt: '+1', size: "20x20")
|
||||
.col
|
||||
%h3=t 'layout.comments.md_cheatsheet.lists'
|
||||
%p{style: 'float:left;margin-left:20px;'}=t 'layout.comments.md_cheatsheet.unordered'
|
||||
%p{style: 'float:right;margin-right:40px;'}=t 'layout.comments.md_cheatsheet.ordered'
|
||||
.both
|
||||
%pre
|
||||
:preserve
|
||||
* Item 1 1. Item 1
|
||||
* Item 2 2. Item 2
|
||||
* Item 2a 3. Item 3
|
||||
* Item 2b * Item 3a
|
||||
* Item 3b
|
||||
%p=t 'layout.comments.md_cheatsheet.reference_format'
|
||||
%pre
|
||||
=preserve t('layout.comments.md_cheatsheet.reference_format_example').html_safe
|
||||
.col
|
||||
%h3=t 'layout.comments.md_cheatsheet.miscellaneous'
|
||||
%p=t 'layout.comments.md_cheatsheet.images'
|
||||
%pre
|
||||
:preserve
|
||||
![avatar](/assets/ava.png)
|
||||
Format: ![Alt Text](url)
|
||||
%p=t 'layout.comments.md_cheatsheet.links'
|
||||
%pre
|
||||
:preserve
|
||||
https://abf.rosalinux.ru
|
||||
[ABF](https://abf.rosalinux.ru/)
|
||||
%p=t 'layout.comments.md_cheatsheet.blockquotes'
|
||||
%pre
|
||||
:preserve
|
||||
As Kanye West said:
|
||||
= render 'projects/comments/markdown_help_body'
|
||||
|
||||
> We're living the future so
|
||||
> the present is our past.
|
||||
.both
|
||||
%hr.bootstrap
|
||||
%h3=t 'layout.comments.md_cheatsheet.code_examples'
|
||||
.col
|
||||
%p
|
||||
=t 'layout.comments.md_cheatsheet.syntax_highlighting'
|
||||
%pre
|
||||
:preserve
|
||||
```javascript
|
||||
function fancyAlert(arg) {
|
||||
if(arg) {
|
||||
$.facebox({div:'#foo'})
|
||||
}
|
||||
}
|
||||
```
|
||||
.col
|
||||
%p=t 'layout.comments.md_cheatsheet.indent_code'
|
||||
%pre
|
||||
:preserve
|
||||
Here is a Python code example
|
||||
without syntax highlighting:
|
||||
|
||||
def foo:
|
||||
if not bar:
|
||||
return true
|
||||
.col
|
||||
%p=t 'layout.comments.md_cheatsheet.inline_code'
|
||||
%pre
|
||||
:preserve
|
||||
I think you should use an
|
||||
`[addr]` element here instead.
|
||||
.both
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
.row
|
||||
.col-md-6
|
||||
h3=t 'layout.comments.md_cheatsheet.format_text'
|
||||
p=t 'layout.comments.md_cheatsheet.headers'
|
||||
pre
|
||||
= '# This is an <h1> tag'
|
||||
br
|
||||
= '## This is an <h2> tag'
|
||||
br
|
||||
= '### This is an <h3> tag'
|
||||
p=t 'layout.comments.md_cheatsheet.text_styles'
|
||||
|
||||
pre
|
||||
| *This text will be italic*
|
||||
br
|
||||
| _This will also be italic_
|
||||
br
|
||||
| **This text will be bold**
|
||||
br
|
||||
| __This will also be bold__
|
||||
p=link_to t('layout.comments.md_cheatsheet.emoji_header'),
|
||||
'http://www.emoji-cheat-sheet.com/', target: '_blank'
|
||||
pre
|
||||
=":smile:"
|
||||
=image_tag("/images/emoji/#{Emoji.find_by_alias('smile').image_filename}",
|
||||
class: 'emoji', title: 'smile', alt: 'smile', size: "20x20")
|
||||
=" :+1:"
|
||||
=image_tag("/images/emoji/#{Emoji.find_by_alias('+1').image_filename}",
|
||||
class: 'emoji', title: '+1', alt: '+1', size: "20x20")
|
||||
.col-md-6
|
||||
h3=t 'layout.comments.md_cheatsheet.lists'
|
||||
p= "#{t 'layout.comments.md_cheatsheet.unordered'} / #{t 'layout.comments.md_cheatsheet.ordered'}"
|
||||
pre
|
||||
| * Item 1 1. Item 1
|
||||
br
|
||||
| * Item 2 2. Item 2
|
||||
br
|
||||
| * Item 2a 3. Item 3
|
||||
br
|
||||
| * Item 2b * Item 3a
|
||||
br
|
||||
| * Item 3b
|
||||
p=t 'layout.comments.md_cheatsheet.reference_format'
|
||||
pre
|
||||
=preserve t('layout.comments.md_cheatsheet.reference_format_example').html_safe
|
||||
|
||||
.clearfix
|
||||
|
||||
.col-md-12
|
||||
h3=t 'layout.comments.md_cheatsheet.code_examples'
|
||||
.col-md-6
|
||||
p= t 'layout.comments.md_cheatsheet.syntax_highlighting'
|
||||
pre
|
||||
| ```javascript
|
||||
br
|
||||
| function fancyAlert(arg) {
|
||||
br
|
||||
| if(arg) {
|
||||
br
|
||||
| $.facebox({div:'#foo'})
|
||||
br
|
||||
| }
|
||||
br
|
||||
| }
|
||||
br
|
||||
| ```
|
||||
|
||||
.col-md-6
|
||||
p=t 'layout.comments.md_cheatsheet.indent_code'
|
||||
pre
|
||||
| Here is a Python code example
|
||||
br
|
||||
| without syntax highlighting:
|
||||
br
|
||||
| def foo:
|
||||
br
|
||||
| if not bar:
|
||||
br
|
||||
| return true
|
||||
|
||||
.col-md-6
|
||||
p= t 'layout.comments.md_cheatsheet.inline_code'
|
||||
pre
|
||||
| I think you should use an
|
||||
br
|
||||
| `[addr]` element here instead.
|
||||
|
||||
.clearfix
|
||||
|
||||
.col-md-12
|
||||
h3=t 'layout.comments.md_cheatsheet.miscellaneous'
|
||||
.row
|
||||
.col-md-6
|
||||
p=t 'layout.comments.md_cheatsheet.images'
|
||||
pre
|
||||
| ![avatar](/assets/ava.png)
|
||||
br
|
||||
| Format: ![Alt Text](url)
|
||||
p=t 'layout.comments.md_cheatsheet.links'
|
||||
pre
|
||||
| https://abf.rosalinux.ru
|
||||
br
|
||||
| [ABF](https://abf.rosalinux.ru/)
|
||||
.col-md-6
|
||||
p=t 'layout.comments.md_cheatsheet.blockquotes'
|
||||
pre
|
||||
| As Kanye West said:
|
||||
br
|
||||
| > We're living the future so
|
||||
br
|
||||
| > the present is our past.
|
|
@ -1,15 +0,0 @@
|
|||
=render 'title_body', f: f, id: 'new'
|
||||
- if can?(:write, @project)
|
||||
.leftlist= t('activerecord.attributes.issue.assignee') + ':'
|
||||
#assigned-container.rightlist
|
||||
=render 'user_container', user: @issue.assignee
|
||||
.both
|
||||
.leftlist= t('layout.issues.labels') + ':'
|
||||
.rightlist
|
||||
%span#flag-span.small-text= t('layout.issues.choose_labels_on_left')
|
||||
#issue_labels
|
||||
.both
|
||||
.leftlist
|
||||
.rightlist
|
||||
= submit_tag t(@issue.new_record? ? 'layout.create' : 'layout.update'), data: {'disable-with' => t('layout.processing')}
|
||||
.both
|
|
@ -0,0 +1,17 @@
|
|||
=render 'title_body', f: f, id: 'new'
|
||||
|
||||
/
|
||||
- if can?(:write, @project)
|
||||
.leftlist= t('activerecord.attributes.issue.assignee') + ':'
|
||||
#assigned-container.rightlist
|
||||
=render 'user_container', user: @issue.assignee
|
||||
.both
|
||||
.leftlist= t('layout.issues.labels') + ':'
|
||||
.rightlist
|
||||
%span#flag-span.small-text= t('layout.issues.choose_labels_on_left')
|
||||
#issue_labels
|
||||
.both
|
||||
.leftlist
|
||||
.rightlist
|
||||
= submit_tag t(@issue.new_record? ? 'layout.create' : 'layout.update'), data: {'disable-with' => t('layout.processing')}
|
||||
.both
|
|
@ -1,4 +1,5 @@
|
|||
<script>
|
||||
<% if action_name == 'index' %>
|
||||
angular.module('RosaABF').service('IssuesInitializer', function(){
|
||||
return {
|
||||
project: '<%= @project.name_with_owner %>',
|
||||
|
@ -8,6 +9,14 @@
|
|||
issues: <%= render('issues.json', issues: @issues).html_safe %>
|
||||
};
|
||||
});
|
||||
<% elsif action_name.in?(['new', 'create']) %>
|
||||
angular.module('RosaABF').service('IssueInitializer', function(){
|
||||
return {
|
||||
project: '<%= @project.name_with_owner %>',
|
||||
labels: <%= render('labels.json', project: @project).html_safe %>,
|
||||
};
|
||||
});
|
||||
<% end %>
|
||||
|
||||
angular.module('RosaABF').service('LabelsInitializer', function(){
|
||||
return {
|
||||
|
|
|
@ -45,8 +45,7 @@ div ng-controller = 'LabelsController as labelsCtrl' ng-cloak = true
|
|||
.lpadding-5[ ng-style = 'labelsCtrl.colorPreviewStyle()' ]
|
||||
span[ ng-style = 'labelsCtrl.colorPreviewStyle()' ] {{ labelsCtrl.label.name }}
|
||||
|
||||
p.text-warning ng-repeat = 'error in labelsCtrl.errors'
|
||||
| {{ error }}
|
||||
p.text-warning[ ng-repeat = 'error in labelsCtrl.errors' ] {{ error }}
|
||||
|
||||
button.btn.btn-primary[ type = 'submit'
|
||||
ng-click = 'labelsCtrl.saveLabel()'
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#open-comment.comment.view
|
||||
%h3.tmargin0= t 'activerecord.attributes.issue.title'
|
||||
.wrapper= f.text_area :title, cols: 80, rows: 1
|
||||
#open-comment.comment.view
|
||||
=render 'projects/comments/button_md_help'
|
||||
%h3.tmargin0= t 'activerecord.attributes.issue.body'
|
||||
=render 'projects/comments/body', f: f, id: id
|
||||
.both
|
|
@ -0,0 +1,10 @@
|
|||
= f.input :title, as: :string, input_html: { maxlength: 80 }
|
||||
|
||||
.panel.panel-info
|
||||
.panel-heading
|
||||
h3.panel-title
|
||||
- t('activerecord.attributes.issue.body')
|
||||
= f.label :body
|
||||
.small.pull-right= render 'projects/comments/button_md_help'
|
||||
.panel-body
|
||||
= render 'projects/comments/body', f: f
|
|
@ -1,10 +0,0 @@
|
|||
-set_meta_tags title: [title_object(@project), t('layout.issues.create_header')]
|
||||
-render 'submenu'
|
||||
-render 'manage_sidebar'
|
||||
|
||||
%h3.bpadding10= t("layout.issues.create_header")
|
||||
=render 'projects/issues/assigned_popup'
|
||||
= form_for :issue, url: project_issues_path(@project), html: { class: 'form issue new' } do |f|
|
||||
= render "form", f: f
|
||||
=hidden_field_tag :preview_url, project_md_preview_path(@project)
|
||||
= render "projects/comments/markdown_help"
|
|
@ -0,0 +1,17 @@
|
|||
-set_meta_tags title: [title_object(@project), t('layout.issues.create_header')]
|
||||
-render 'submenu'
|
||||
-render 'manage_sidebar'
|
||||
|
||||
.container ng-controller = 'IssueController as issueCtrl' ng-cloak = true
|
||||
.row
|
||||
.col-md-3.col-sm-4.offset20
|
||||
= render 'manage_labels', project: @project
|
||||
.col-md-9.col-sm-8.offset20
|
||||
= simple_form_for @issue do |f|
|
||||
h3= title t('layout.issues.create_header')
|
||||
= render 'form', f: f
|
||||
|
||||
= render 'projects/comments/markdown_help'
|
||||
|
||||
- content_for :additional_scripts do
|
||||
= render 'init_service.js.erb'
|
Loading…
Reference in New Issue