Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
66539563
Commit
66539563
authored
May 12, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added eventHub events to change the showForm value
[ci skip]
parent
5d19bda4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
37 deletions
+59
-37
app/assets/javascripts/issue_show/index.js
app/assets/javascripts/issue_show/index.js
+58
-36
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-1
No files found.
app/assets/javascripts/issue_show/index.js
View file @
66539563
import
Vue
from
'
vue
'
;
import
eventHub
from
'
./event_hub
'
;
import
issuableApp
from
'
./components/app.vue
'
;
import
'
../vue_shared/vue_resource_interceptor
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
el
:
document
.
getElementById
(
'
js-issuable-app
'
),
components
:
{
issuableApp
,
},
data
()
{
const
issuableElement
=
this
.
$options
.
el
;
const
issuableTitleElement
=
issuableElement
.
querySelector
(
'
.title
'
);
const
issuableDescriptionElement
=
issuableElement
.
querySelector
(
'
.wiki
'
);
const
issuableDescriptionTextarea
=
issuableElement
.
querySelector
(
'
.js-task-list-field
'
);
const
{
canUpdate
,
endpoint
,
issuableRef
,
}
=
issuableElement
.
dataset
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
$
(
'
.issuable-edit
'
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
preventDefault
();
return
{
canUpdate
:
gl
.
utils
.
convertPermissionToBoolean
(
canUpdate
),
endpoint
,
issuableRef
,
initialTitle
:
issuableTitleElement
.
innerHTML
,
initialDescriptionHtml
:
issuableDescriptionElement
?
issuableDescriptionElement
.
innerHTML
:
''
,
initialDescriptionText
:
issuableDescriptionTextarea
?
issuableDescriptionTextarea
.
textContent
:
''
,
};
},
render
(
createElement
)
{
return
createElement
(
'
issuable-app
'
,
{
props
:
{
canUpdate
:
this
.
canUpdate
,
endpoint
:
this
.
endpoint
,
issuableRef
:
this
.
issuableRef
,
initialTitle
:
this
.
initialTitle
,
initialDescriptionHtml
:
this
.
initialDescriptionHtml
,
initialDescriptionText
:
this
.
initialDescriptionText
,
eventHub
.
$emit
(
'
open.form
'
);
});
return
new
Vue
({
el
:
document
.
getElementById
(
'
js-issuable-app
'
),
components
:
{
issuableApp
,
},
data
()
{
const
issuableElement
=
this
.
$options
.
el
;
const
issuableTitleElement
=
issuableElement
.
querySelector
(
'
.title
'
);
const
issuableDescriptionElement
=
issuableElement
.
querySelector
(
'
.wiki
'
);
const
issuableDescriptionTextarea
=
issuableElement
.
querySelector
(
'
.js-task-list-field
'
);
const
{
canUpdate
,
endpoint
,
issuableRef
,
}
=
issuableElement
.
dataset
;
return
{
canUpdate
:
gl
.
utils
.
convertPermissionToBoolean
(
canUpdate
),
endpoint
,
issuableRef
,
initialTitle
:
issuableTitleElement
.
innerHTML
,
initialDescriptionHtml
:
issuableDescriptionElement
?
issuableDescriptionElement
.
innerHTML
:
''
,
initialDescriptionText
:
issuableDescriptionTextarea
?
issuableDescriptionTextarea
.
textContent
:
''
,
showForm
:
false
,
};
},
methods
:
{
openForm
()
{
this
.
showForm
=
true
;
console
.
log
(
this
.
showForm
);
},
});
},
}));
},
created
()
{
eventHub
.
$on
(
'
open.form
'
,
this
.
openForm
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
open.form
'
,
this
.
openForm
);
},
render
(
createElement
)
{
return
createElement
(
'
issuable-app
'
,
{
props
:
{
canUpdate
:
this
.
canUpdate
,
endpoint
:
this
.
endpoint
,
issuableRef
:
this
.
issuableRef
,
initialTitle
:
this
.
initialTitle
,
initialDescriptionHtml
:
this
.
initialDescriptionHtml
,
initialDescriptionText
:
this
.
initialDescriptionText
,
},
});
},
});
});
app/views/projects/issues/show.html.haml
View file @
66539563
...
...
@@ -35,7 +35,7 @@
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
data:
{
no_turbolink:
true
},
class:
"btn-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
%li
=
link_to
'Edit'
,
edit_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
)
=
link_to
'Edit'
,
edit_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
)
,
class:
'issuable-edit'
-
if
@issue
.
submittable_as_spam_by?
(
current_user
)
%li
=
link_to
'Submit as spam'
,
mark_as_spam_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment