Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Board: move notice/readme opts to below uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
laziel committed Aug 21, 2014
1 parent 986253d commit 257eb0b
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 134 deletions.
118 changes: 61 additions & 57 deletions app/views/board/create.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,71 +20,76 @@
**@
@(title:String, form:Form[Posting], project:Project, isAllowedToNotice:Boolean, preparedPostBody:String = "")

@import utils.AccessControl._
@import utils.TemplateHelper._
@import utils.HtmlUtil._
@import models.enumeration._
@implicitField = @{ helper.FieldConstructor(simpleForm) }

@readmeUpdateMessage = @{
if( request().getQueryString("readme") != null ) {
"Update README.md"
}
if( request().getQueryString("readme") != null ) {
"Update README.md"
}
}

@projectLayout(title, project, utils.MenuType.BOARD) {
@projectMenu(project, utils.MenuType.BOARD, "main-menu-only")
<div class="page-wrap-outer">
<div class="project-page-wrap">
<form action="@routes.BoardApp.newPost(project.owner, project.name)" method="post" enctype="multipart/form-data" class="nm">
<div class="content-wrap frm-wrap">
<dl>
<dt>
<label for="title">@Messages("title")</label>
</dt>
<dd>
@defining(form.errors().get("title")) { errors =>
<input type="text" id="title" name="title" class="zen-mode text title @if(errors != null) {error}" maxlength="250" tabindex="1" value="@readmeUpdateMessage"/>
@if(errors != null) {
<div class="message">
@for(error <- errors) {
<div>@Messages(error.message)</div>
}
</div>
}
}
</dd>
<div class="project-page-wrap">
<form action="@routes.BoardApp.newPost(project.owner, project.name)" method="post" enctype="multipart/form-data" class="nm">
<div class="content-wrap frm-wrap">
<dl>
<dt>
<label for="title">@Messages("title")</label>
</dt>
<dd>
@defining(form.errors().get("title")) { errors =>
<input type="text" id="title" name="title" class="zen-mode text title @if(errors != null) {error}" maxlength="250" tabindex="1" value="@readmeUpdateMessage"/>
@if(errors != null) {
<div class="message">
@for(error <- errors) {
<div>@Messages(error.message)</div>
}
</div>
}
}
</dd>
<dd style="position: relative;">
@common.editor("body", preparedPostBody, "tabindex=2")
</dd>
</dl>

<dd style="position: relative;">
@common.editor("body", preparedPostBody, "tabindex=2")
</dd>
@** fileUploader **@
@if(!UserApp.currentUser.isAnonymous) {
@common.fileUploader(ResourceType.BOARD_POST, null)
}
@** end of fileUploader **@

@if(isAllowedToNotice){
<dd class="right-txt">
<input type="checkbox" id="notice" name="notice" class="checkbox" /><!--
--><label for="notice" class="label-public">@Messages("post.notice.label")</label>
@if(project.isGit && request().getQueryString("readme") != null ) {
<input type="checkbox" id="readme" name="readme" class="checkbox" @boolToCheckedString(request().getQueryString("readme"))
/><!--
--><label for="readme" class="label-public">@Messages("post.readmefy")</label>
}
</dd>
}
</dl>
<div class="right-txt mt10 mb10">
@if(isAllowedToNotice && !stringToBoolean(request().getQueryString("readme"))){
<label class="checkbox">
<input type="checkbox" id="notice" name="notice">
@Messages("post.notice.label")
</label>
}

@** fileUploader **@
@if(!UserApp.currentUser.isAnonymous) {
@common.fileUploader(ResourceType.BOARD_POST, null)
@if(isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)){
@if(project.isGit && stringToBoolean(request().getQueryString("readme"))){
<label class="checkbox">
<input type="checkbox" id="readme" name="readme" @boolToCheckedString(request().getQueryString("readme"))>
@Messages("post.readmefy")
</label>
}
@** end of fileUploader **@

<div class="actions">
<button class="ybtn ybtn-success" tabindex="3">@Messages("button.save")</button><!--
--><a href="javascript:history.back();" class="ybtn" tabindex="4">@Messages("button.cancel")</a>
</div>
}
</div>

</div>
</form>
</div>
<div class="actions">
<button class="ybtn ybtn-success" tabindex="3">@Messages("button.save")</button><!--
--><a href="javascript:history.back();" class="ybtn" tabindex="4">@Messages("button.cancel")</a>
</div>
</div>
</form>
</div>
</div>

@common.markdown(project)
Expand All @@ -93,16 +98,15 @@
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.caret.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.js")"></script>
<script type="text/javascript">
$(document).ready(function(){
$yobi.loadModule("board.Write", {
"sMode" : "new",
"elTextarea" : 'textarea[data-editor-mode="content-body"]',
"sUploaderAction": "@routes.AttachmentApp.uploadFile()"
});
$(function(){
$yobi.loadModule("board.Write", {
"sMode" : "new",
"elTextarea": 'textarea[data-editor-mode="content-body"]'
});

yobi.Mention({
target:'textarea[id^=editor-]',
url : "@Html(routes.ProjectApp.mentionList(project.owner, project.name).toString())"
"target": 'textarea[id^=editor-]',
"url" : "@Html(routes.ProjectApp.mentionList(project.owner, project.name).toString())"
});
});
</script>
Expand Down
117 changes: 60 additions & 57 deletions app/views/board/edit.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,84 +20,87 @@
**@
@(title:String, form:Form[Posting], posting:Posting, number:Long, project:Project, isAllowedToNotice:Boolean)

@import scala.collection.Map
@import utils.AccessControl._
@import utils.TemplateHelper._
@import utils.HtmlUtil._
@import models.enumeration.ResourceType
@implicitField = @{ helper.FieldConstructor(simpleForm) }
@import utils.HtmlUtil._

@projectLayout(title, project, utils.MenuType.BOARD) {
@projectMenu(project, utils.MenuType.BOARD, "main-menu-only")
<div class="page-wrap-outer">
<div class="project-page-wrap">
<form action="@routes.BoardApp.editPost(project.owner, project.name, number)" method="post" enctype="multipart/form-data" class="nm">
<div class="content-wrap frm-wrap">
<dl>
<dt>
<label for="title">@Messages("title")</label>
</dt>
<dd>
@defining(form.errors().get("title")) { errors =>
<input type="text" id="title" name="title" value="@posting.title" class="zen-mode text title @if(errors != null) {error}" maxlength="250" tabindex="1" />
@if(errors != null) {
<div class="message">
@for(error <- errors) {
<div>@Messages(error.message)</div>
}
</div>
}
}
</dd>

<dd style="position: relative;">
@common.editor("body", posting.body, "tabindex=2", "content-body")
</dd>

@if(isAllowedToNotice){
@helper.input(form("notice")){(id, name, value, args) =>
<dd class="right-txt">
<input type="checkbox" id="notice" name="notice" class="checkbox" @toHtmlArgs(args) @(if(value.equals(Some("true"))) "checked" else "")/><!--
--><label for="notice" class="label-public">@Messages("post.notice.label")</label>
@if(project.isGit){
<input type="checkbox" id="readme" name="readme" class="checkbox" @boolToCheckedString(posting.readme)/>
<label for="readme" class="label-public">@Messages("post.readmefy")</label>
<div class="project-page-wrap">
<form action="@routes.BoardApp.editPost(project.owner, project.name, number)" method="post" enctype="multipart/form-data" class="nm">
<div class="content-wrap frm-wrap">
<dl>
<dt>
<label for="title">@Messages("title")</label>
</dt>
<dd>
@defining(form.errors().get("title")) { errors =>
<input type="text" id="title" name="title" value="@posting.title" class="zen-mode text title @if(errors != null) {error}" maxlength="250" tabindex="1" />
@if(errors != null) {
<div class="message">
@for(error <- errors) {
<div>@Messages(error.message)</div>
}
</dd>
}
}
</dl>
</div>
}
}
</dd>
<dd style="position: relative;">
@common.editor("body", posting.body, "tabindex=2", "content-body")
</dd>
</dl>

@** fileUploader **@
@if(!UserApp.currentUser.isAnonymous) {
@common.fileUploader(ResourceType.BOARD_POST, posting.id)
}
@** end of fileUploader **@

@** fileUploader **@
@if(!UserApp.currentUser.isAnonymous) {
@common.fileUploader(ResourceType.BOARD_POST, posting.id)
<div class="right-txt mt10 mb10">
@if(isAllowedToNotice && !stringToBoolean(request().getQueryString("readme"))){
@helper.input(form("notice")){(id, name, value, args) =>
<label class="checkbox">
<input type="checkbox" id="notice" name="notice" @toHtmlArgs(args) @(if(value.equals(Some("true"))) "checked" else "")/>
@Messages("post.notice.label")
</label>
}
@** end of fileUploader **@
}

<div class="actions">
<button class="ybtn ybtn-info" tabindex="3">@Messages("button.save")</button><!--
--><a href="javascript:history.back();" class="ybtn" tabindex="4">@Messages("button.cancel")</a>
</div>
@if(project.isGit && isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)){
<label class="checkbox">
<input type="checkbox" id="readme" name="readme" @boolToCheckedString(posting.readme)/>
@Messages("post.readmefy")
</label>
}
</div>

</div>
</form>
</div>
<div class="actions">
<button class="ybtn ybtn-info" tabindex="3">@Messages("button.save")</button><!--
--><a href="javascript:history.back();" class="ybtn" tabindex="4">@Messages("button.cancel")</a>
</div>
</div>
</form>
</div>
</div>

@common.markdown(project)

<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.css")">
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.caret.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.js")"></script>
<script type="text/javascript">
$(document).ready(function(){
$yobi.loadModule("board.Write", {
"sMode" : "edit",
"elTextarea" : 'textarea[data-editor-mode="content-body"]',
"sUploaderAction": "@routes.AttachmentApp.uploadFile"
});
$(function(){
$yobi.loadModule("board.Write", {
"sMode" : "edit",
"elTextarea": 'textarea[data-editor-mode="content-body"]'
});

yobi.Mention({
target:'textarea[id^=editor-]',
url : "@Html(routes.ProjectApp.mentionList(project.owner, project.name, posting.getNumber, posting.asResource().getType().resource()).toString())"
"target": 'textarea[id^=editor-]',
"url" : "@Html(routes.ProjectApp.mentionList(project.owner, project.name, posting.getNumber, posting.asResource().getType().resource()).toString())"
});
});
</script>
Expand Down
39 changes: 21 additions & 18 deletions app/views/project/partial_readme.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,28 @@

<div class="bubble-wrap gray readme">
@if(project.readme == null){
<p class="default">
@if(project.vcs.equals("GIT")) {
<span>@Messages("project.readme")</span><br/><br/>
@if(isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)) {
<a href="@routes.BoardApp.newPostForm(project.owner, project.name)?readme=true" class="ybtn">@Messages("project.readme.create")</a>
}
} else {
<span>@Messages("project.svn.readme")</span>
}
</p>
<p class="default">
@if(project.isGit){
<span>@Messages("project.readme")</span>
<br><br>
@if(isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)){
<a href="@routes.BoardApp.newPostForm(project.owner, project.name)?readme=true" class="ybtn">@Messages("project.readme.create")</a>
}
} else {
<span>@Messages("project.svn.readme")</span>
}
</p>
} else {
<div class="readme-wrap">
<header><i class="yobicon-book-open"></i><strong> @project.getReadmeFileName</strong>
@if(isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)) {
<a href="@routes.BoardApp.newPostForm(project.owner, project.name)?readme=true" class="ybtn">edit</a>
}
</header>
<div class="readme-body markdown-wrap markdown-before" markdown="true">@project.readme</div>
</div>
<div class="readme-wrap">
<header>
<i class="yobicon-book-open vmiddle"></i>
<strong class="vmiddle"> @project.getReadmeFileName</strong>
@if(project.isGit && isProjectResourceCreatable(UserApp.currentUser(), project, ResourceType.COMMIT)){
<a href="@routes.BoardApp.newPostForm(project.owner, project.name)?readme=true" class="ybtn vmiddle ml5">@Messages("button.edit")</a>
}
</header>
<div class="readme-body markdown-wrap markdown-before" markdown="true">@project.readme</div>
</div>
}
@common.markdown(project)
</div>
2 changes: 1 addition & 1 deletion conf/messages.ko
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ post.popup.fileAttach.contents = 첨부할 파일을 선택해주세요.
post.popup.fileAttach.hasMissing = 첨부되지 못한 파일이 {0}개 있습니다.
post.popup.fileAttach.hasMissing.description = 업로드 후 {1}분이 지나도록 글 작성을 완료하지 않은 경우 이 문제가 발생할 수 있습니다. 파일을 다시 첨부해 주세요.
post.popup.fileAttach.title = 첨부파일 선택
post.readmefy= 프로젝트 README 파일로 만듭니다
post.readmefy= 이 글을 프로젝트 README 파일로 만듭니다
post.unwatch.start = 이제 이 글에 관한 알림을 받지 않습니다
post.update.error = 입력값 오류
post.watch.start = 이제 이 글에 관한 알림을 받습니다
Expand Down
1 change: 0 additions & 1 deletion public/javascripts/service/yobi.board.Write.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
*/
function _initVar(htOptions){
htVar.sMode = htOptions.sMode || "new";
htVar.sUploaderAction = htOptions.sUploaderAction;
htVar.sTplFileItem = htOptions.sTplFileItem || (htElement.welTplFileItem ? htElement.welTplFileItem.text() : "");
}

Expand Down

0 comments on commit 257eb0b

Please sign in to comment.