CoffeeScript编写简单新闻页(仅UI)
作者:互联网
CoffeeScript编写简单新闻页(仅UI)
1. 配置(在公司搭建好的环境下配置)
- omnisocials-backend/src/backend/modules/member/config/main.php文件夹下配置如下代码:
[
'order' => 6,
'title' => 'member_myNews',
'name' => 'myNews',
'state' => 'member-myNews'
],
- order: 每加一个页面order数值加一。
- title: pc端左侧导航栏(链接右侧页面)title。
- name: pc端左侧导航栏链接的右侧html页面名称。
- state: omnisocials-frontend/src/static/portal/modules/member/config.json中配置(稍后说明)。
- 格式仿照上文,不能随意写,否则不能识别。
- omnisocials-frontend/src/static/portal/modules/member/i18n/locate-zh_cn.json配置title,代码如下:
"member_myNews": "创建新闻",
- omnisocials-frontend/src/static/portal/modules/member/config.json配置state,代码如下:
"member-myNews",
- omnisocials-frontend/src/static/portal/modules/member/partials写页面右侧链接html页面,例如:myNews.html.
- omnisocials-frontend/src/static/portal/modules/member/styles写页面右侧链接html页面的样式代码,例如: myNews.css。
- omnisocials-frontend/src/static/portal/modules/member/index.scss 把css页面配到里面,这样html才会有样式。
- /home/user/omnisocials/omnisocials-frontend/src/static/portal/modules/member/controllers写coffee脚本。
2. 各文件代码
- myNews.html
<div wm-breadcrumb="myNews.breadcrumb"></div>
<form>
<div>
<div class="plate-category">
<span class="required-sign">*</span><span class="required-content">新闻作者</span>
<input type="text" />
</div>
</div>
<div>
<div class="plate-category">
<span class="required-sign">*</span ><span class="required-content">新闻标题</span>
<input type="text"/>
</div>
</div>
<div>
<div class="plate-category">
<span class="required-sign">*</span><span class="required-content">新闻内容</span>
<textarea class="textarea-filed"></textarea>
</div>
</div>
<input class="submit-button" type="submit" value="保存"/>
</form>
- myNews.css
$required-sign-color:red;
$border-color:#e2e2e2;
$submit-button-color:#fff;
$submit-button-background-color:#37c3aa;
body {
font-size: 14px;
}
input {
display: block;
width: 50%;
height: 30px;
border: 1px solid $border-color;
}
.plate-category {
margin-top: 50px;
}
.required-sign {
color: $required-sign-color;
}
.required-content {
font-family: Arial,'Microsoft YaHei';
}
.textarea-filed {
width: 50%;
height: 106px;
padding: 10px;
border: 1px solid $border-color;
border-radius: 2px;
resize: vertical;
box-sizing: border-box;
box-shadow: none;
display: block;
}
.submit-button {
color: $submit-button-color;
background-color: $submit-button-background-color;
border-color: transparent;
width: 10%;
margin-top: 50px;
}
- myNewsCtrl.coffee
define [
'wm/app'
'wm/config'
], (app, config) ->
app.registerController 'wm.ctrl.member.myNews', [
'restService'
'$filter'
'$location'
'notificationService'
'utilService'
(restService, $filter, $location, notificationService, utilService) ->
vm = this
initBreadcrumb = ->
vm.breadcrumb = [
text: 'member_myNews'
icon: 'statmember'
]
init = ->
initBreadcrumb()
init()
vm
]
标签:myNews,src,color,member,CoffeeScript,UI,新闻页,border,omnisocials 来源: https://blog.51cto.com/u_11462036/2794948