mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Update the styling and workflow around publishing a template
This commit is contained in:
@@ -290,22 +290,29 @@
|
|||||||
-if(session && session.user && session.user.isAdmin)
|
-if(session && session.user && session.user.isAdmin)
|
||||||
.box
|
.box
|
||||||
.page-header
|
.page-header
|
||||||
h2 Publish Project
|
h2 Publish project as template
|
||||||
|
|
||||||
|
#publishedAsTemplateArea.show-when-published.alert.alert-success
|
||||||
|
p
|
||||||
|
.btn.btn-warning#unPublishProjectAsTemplate.pull-right Unpublish
|
||||||
|
i.icon-ok
|
||||||
|
| Your project is currently published.
|
||||||
|
a#templateLink(href='{{canonicalUrl}}') View in template gallery.
|
||||||
|
p
|
||||||
|
| Lastest version: {{publishedDate}}.
|
||||||
|
|
||||||
#publishedAsTemplateArea(style="display:none;")
|
#problemWithPublishingArea
|
||||||
a#templateLink(href='{{canonicalUrl}}') View Template
|
|
||||||
p published at {{publishedDate}}
|
|
||||||
.btn.btn-warning#unPublishProjectAsTemplate unpublish project as template
|
|
||||||
.btn.btn-success#republishProjectAsTemplate re publish project as template
|
|
||||||
|
|
||||||
#problemWithPublishingArea(style="display:none;")
|
|
||||||
p There is a problem with our publishing service, please try again in a few minutes.
|
p There is a problem with our publishing service, please try again in a few minutes.
|
||||||
#publishWorkingArea(style="display:none;")
|
#publishWorkingArea
|
||||||
p Working.....
|
p Working...
|
||||||
#unpublishedAsTemplateArea(style="display:none;")
|
div.show-when-published.show-when-unpublished.project-description
|
||||||
.btn.btn-success#publishProjectAsTemplate Publish project as template
|
label(for="project-description") Description
|
||||||
div
|
.row-fluid
|
||||||
textarea.span6#projectDescription {{description}}
|
textarea(placeholder="Template description", name="project-description").span12#projectDescription {{description}}
|
||||||
|
#unpublishedAsTemplateArea.show-when-unpublished
|
||||||
|
.btn.btn-success#publishProjectAsTemplate Publish
|
||||||
|
p.show-when-published
|
||||||
|
button.btn.btn-success#republishProjectAsTemplate Re-Publish
|
||||||
|
|
||||||
|
|
||||||
script(type="text/template")#settingsPanelTemplate
|
script(type="text/template")#settingsPanelTemplate
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ define [
|
|||||||
"models/ProjectMemberList"
|
"models/ProjectMemberList"
|
||||||
"account/AccountManager"
|
"account/AccountManager"
|
||||||
"utils/Modal"
|
"utils/Modal"
|
||||||
|
"moment"
|
||||||
"libs/backbone"
|
"libs/backbone"
|
||||||
"libs/mustache"
|
"libs/mustache"
|
||||||
], (User, ProjectMemberList, AccountManager, Modal) ->
|
], (User, ProjectMemberList, AccountManager, Modal, moment) ->
|
||||||
INFINITE_COLLABORATORS = -1
|
INFINITE_COLLABORATORS = -1
|
||||||
|
|
||||||
class ProjectMembersManager
|
class ProjectMembersManager
|
||||||
@@ -20,6 +21,8 @@ define [
|
|||||||
name: "Share"
|
name: "Share"
|
||||||
content : $(@templates.userPanel)
|
content : $(@templates.userPanel)
|
||||||
lock: true
|
lock: true
|
||||||
|
onShown: () =>
|
||||||
|
@publishProjectView.refreshPublishStatus()
|
||||||
|
|
||||||
setupPublish = _.once =>
|
setupPublish = _.once =>
|
||||||
@publishProjectView = new PublishProjectView
|
@publishProjectView = new PublishProjectView
|
||||||
@@ -179,25 +182,32 @@ define [
|
|||||||
initialize: () ->
|
initialize: () ->
|
||||||
@ide = @options.ide
|
@ide = @options.ide
|
||||||
@model = @ide.project
|
@model = @ide.project
|
||||||
_.bindAll(this, "render");
|
@render()
|
||||||
this.model.bind('change', this.render)
|
|
||||||
@refreshPublishStatus()
|
|
||||||
|
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
viewModel =
|
viewModel =
|
||||||
description: @model.get("description")
|
description: @model.get("description")
|
||||||
canonicalUrl: @model.get("template.canonicalUrl")
|
canonicalUrl: @model.get("template.canonicalUrl")
|
||||||
isPublished: @model.get("template.isPublished")
|
isPublished: @model.get("template.isPublished")
|
||||||
publishedDate: @model.get("template.publishedDate")
|
publishedDate: moment(@model.get("template.publishedDate")).format("Do MMM YYYY, h:mm a")
|
||||||
|
|
||||||
$(@el).html $(Mustache.to_html(@template, viewModel))
|
@$el.html $(Mustache.to_html(@template, viewModel))
|
||||||
@publishedArea = $('#publishedAsTemplateArea')
|
@publishedArea = $('.show-when-published')
|
||||||
@unpublishedArea = $('#unpublishedAsTemplateArea')
|
@unpublishedArea = $('.show-when-unpublished')
|
||||||
|
$('#problemWithPublishingArea').hide()
|
||||||
|
$('#publishWorkingArea').hide()
|
||||||
|
|
||||||
|
refreshView: () ->
|
||||||
|
if @model.get("template.isPublished")
|
||||||
|
@$("a#templateLink").attr("href", @model.get("template.canonicalUrl"))
|
||||||
|
@publishedArea.show()
|
||||||
|
else
|
||||||
|
@unpublishedArea.show()
|
||||||
|
|
||||||
refreshPublishStatus: ->
|
refreshPublishStatus: ->
|
||||||
|
@showWorking()
|
||||||
@ide.socket.emit "getPublishedDetails", @ide.user.get("id"), (err, details)=>
|
@ide.socket.emit "getPublishedDetails", @ide.user.get("id"), (err, details)=>
|
||||||
|
@hideWorking()
|
||||||
if err?
|
if err?
|
||||||
return @showError()
|
return @showError()
|
||||||
|
|
||||||
@@ -205,16 +215,17 @@ define [
|
|||||||
if details.exists
|
if details.exists
|
||||||
@model.set("template.canonicalUrl", details.canonicalUrl)
|
@model.set("template.canonicalUrl", details.canonicalUrl)
|
||||||
@model.set("template.publishedDate", details.publishedDate)
|
@model.set("template.publishedDate", details.publishedDate)
|
||||||
@publishedArea.show()
|
|
||||||
@unpublishedArea.hide()
|
@refreshView()
|
||||||
else
|
|
||||||
@publishedArea.hide()
|
|
||||||
@unpublishedArea.show()
|
|
||||||
|
|
||||||
showError: ->
|
showError: ->
|
||||||
|
@publishedArea.hide()
|
||||||
|
@unpublishedArea.hide()
|
||||||
$('#problemWithPublishingArea').show()
|
$('#problemWithPublishingArea').show()
|
||||||
|
|
||||||
showWorking: ->
|
showWorking: ->
|
||||||
|
@publishedArea.hide()
|
||||||
|
@unpublishedArea.hide()
|
||||||
$('#publishWorkingArea').show()
|
$('#publishWorkingArea').show()
|
||||||
|
|
||||||
hideWorking: ->
|
hideWorking: ->
|
||||||
|
|||||||
@@ -891,6 +891,18 @@ i[class*="sprite-"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.project-description {
|
||||||
|
textarea {
|
||||||
|
min-height: 120px;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
border-bottom: 1px solid #eeeeee;
|
||||||
|
font-size: 1.2em;
|
||||||
|
line-height: 1.8em;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn-facebook {
|
.btn-facebook {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||||
|
|||||||
Reference in New Issue
Block a user