Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added delete-article action

  • Loading branch information...
commit c21b6d5c347629c6ee73fad99d0bfac8132af1c7 1 parent c66410f
@chetanankola authored
View
56 mojits/board/assets/index.css
@@ -11,10 +11,6 @@
text-shadow: 1px 1px 0 white;
}
-
-
-
-
.noborder{
border:none;
background:red;
@@ -23,26 +19,58 @@
.article{
cursor:pointer;
background:#eee;
+ line-height:80px;
+ padding-bottom:20px;
+ padding-top:20px;
margin:3px;
- word-wrap: break-word;
- text-align:center;
+ border-radius:4px;
+ /*word-wrap: break-word;
+ text-align:center;*/
+ margin-bottom:10px;
}
.article:hover {
background:#ccc;
}
-.article h2{
+
+.article .content {
+ display:inline;
font-size:3em;
+ line-height:70px;
word-wrap: break-word;
margin:3px;
+ padding:10px;
+ /*border:1px solid #777;
+ background:#fff;*/
+ color:#777;
}
-.btn-delete{
- border:1px solid #ccc;
- padding:0px;
- font-size:1.0em;
+.article .del-icon{
+
+ display:inline;
+ padding:10px;
+ border:1px solid #777;
background:#fff;
- border-radius:20px;
- text-align:center;
-}
+ color:#777;
+ -webkit-transition:all 0.1s;
+}
+.article .del-icon:hover{
+ color:#000;
+ border:1px solid #999;
+ box-shadow: 0 4px 4px -3px #555;
+ -webkit-transition:all 0.1s;
+}
+.article .del-icon:active{
+ box-shadow: none;
+ border:2px solid #000;
+}
+
+.article .article-meta {
+ display:inline;
+ padding:10px;
+ border:1px solid #777;
+ background:#eee;
+ color:#aaa;
+
+}
View
27 mojits/board/binders/index.js
@@ -42,13 +42,20 @@ YUI.add('boardBinderIndex', function (Y, NAME) {
var args = {
params: {
route: {
- call: 'deleteEntry',
+ call: 'editEntry',
id: e.currentTarget.get('id')
}
}
};
self.mojitProxy.refreshView(args);
});
+
+ node.all('.del-icon').on('click', function (e) {
+ Y.fire('DELETE_ARTICLE', {}, {
+ id: e.target.get('id')
+ });
+ });
+
},
@@ -116,6 +123,24 @@ YUI.add('boardBinderIndex', function (Y, NAME) {
self.mojitProxy.refreshView(args);
});
+ Y.on('DELETE_ARTICLE', function (e, dataObj) {
+ var args;
+ if (dataObj) {
+ console.log(dataObj.id);
+ args = {
+ params: {
+ route: {
+ defer: true,
+ call: 'deleteArticle',
+ id: dataObj.id || ''
+ }
+ }
+ };
+ this.mojitProxy.refreshView(args);
+ } else {
+ console.log('no dataObj sent in the broadcast DELETE_ENTRY');
+ }
+ }, this);
Y.on('UPDATE_BOARD', function (e, input) {
var args = {
params: {
View
13 mojits/board/controller.server.js
@@ -43,8 +43,9 @@ YUI.add('board', function (Y, NAME) {
if (ac.params.getFromRoute('call') === 'addArticle') {
return this.addArticle(ac);
}
- if (ac.params.getFromRoute('call') === 'deleteEntry') {
- return this.deleteEntry(ac, ac.params.getFromRoute('id'));
+ if (ac.params.getFromRoute('call') === 'deleteArticle') {
+ Y.log('deleteArticle', 'warn');
+ return this.deleteArticle(ac, ac.params.getFromRoute('id'));
}
//return this.deleteEntry(ac, 218);
return this.showAllArticles(ac);
@@ -65,14 +66,14 @@ YUI.add('board', function (Y, NAME) {
}
for (i = 0; i < replies.length; i++) {
output[i] = JSON.parse(replies[i].toString());//JSON.parse(replies[i]);
- Y.log(output[i], "warn");
+ //Y.log(output[i], "warn");
}
if (replies.length === 0) {
finalOutput.empty = {msg: 'emptyDb'};
}
client.quit();
finalOutput.output = output;
- finalOutput.customMsg = {msg: 'meh meh you are a noobe'};
+ //finalOutput.customMsg = {msg: 'meh meh you are a noobe'};
ac.done(finalOutput);
});
},
@@ -131,7 +132,9 @@ YUI.add('board', function (Y, NAME) {
});
},
- deleteEntry: function (ac, id) {
+ deleteArticle: function (ac, id) {
+ Y.log('deleteEntry function', 'warn');
+ console.log(id);
var output,
self = this,
redis = require("redis"),
View
17 mojits/board/views/index.mu.html
@@ -1,14 +1,15 @@
<div id="{{mojit_view_id}}" class="board {{#empty}}noborder{{/empty}}">
<div id="output">
- {{#output}}
- <div class='article' id='{{id}}'>
- <h2>{{value}} <span class="btn-delete">x</span></h2>
- <span>{{key}}</span>
- </div>
- {{/output}}
+ <ul>
+ {{#output}}
+ <li class='article' id='{{id}}'>
+ <div class="content">{{value}}</div>
+ <div class="article-meta">{{key}}</div>
+ <div class="del-icon" id='{{id}}'>X</div>
+ </li>
+ {{/output}}
+ </ul>
</div>
-
-
{{#customMsg}}<h2>{{msg}} </h2>{{/customMsg}}
{{#empty}} <h2>{{msg}}</h2>{{/empty}}
</div>
View
1  mojits/boardInputBox/assets/index.css
@@ -21,6 +21,7 @@
border-radius:4px;
text-align: center;
box-shadow: 0 5px 5px -5px #777;
+ min-width:330px;
}

1 comment on commit c21b6d5

@chetanankola

:--O

Please sign in to comment.
Something went wrong with that request. Please try again.