Permalink
Browse files

more cleanup

  • Loading branch information...
1 parent 9d75dba commit 92ccabde76d0f49526b3c35d6fa56b3d6ed9a5fa @dpirek committed Nov 7, 2011
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -121,7 +121,7 @@
allMenuItems = $('a', menuHtml),
currentMenuItem = $('a:[href^="#' + controllerName + '"]', menuHtml),
childMenuItemParent = $('a:[childUrls*="' + controllerName + '"]', menuHtml);
-
+
// Remove highliting.
allMenuItems.removeClass('selected');
@@ -135,9 +135,17 @@
var sideNavHtml = $(html.menu(sideMenuObj[controllerName]));
sideNav.html(sideNavHtml);
-
+
var allSideMenuItems = $('a', sideNavHtml),
currentSideMenuItem = $('a:[href^="#' + controllerName + '"]', sideNavHtml);
+
+ // Hack selector for Template controller.
+ if(controllerName === 'Template'){
+ if(d.actionObject.p1 === '1'){
+ d.actionObject.p1 = 'page.index';
+ }
+ currentSideMenuItem = $('a:[href="#' + controllerName + '/' + d.actionObject.action + '/' + d.actionObject.p1 + '"]', sideNavHtml);
+ }
// Remove highliting.
allSideMenuItems.removeClass('selected');
@@ -153,10 +161,6 @@
$('#header').fadeIn();
$('#main').fadeIn();
- // Build side Menu.
- //menuHtml = $(html.menu(menuObj));
- //sideMenu
-
messageElm.hide().text("");
},
error: function (ex) {
@@ -386,21 +386,28 @@ table.data_table tr.lead_status_row_1 td{ background-color:#FFFFCC;}
margin-left: -100px;
padding: 5px;
font-weight: bold;
- -moz-border-bottom-left-radius: 5px;
- -webkit-border-bottom-left-radius: 5x;
- border-bottom-left-radius: 5px;
- -moz-border-bottom-right-radius: 5px;
- -webkit-border-bottom-right-radius: 5x;
- border-bottom-right-radius: 5px; }
+ -moz-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-left-radius: 5x;
+ border-bottom-left-radius: 5px;
+ -moz-border-bottom-right-radius: 5px;
+ -webkit-border-bottom-right-radius: 5x;
+ border-bottom-right-radius: 5px;
+}
table.data_table tr.lead_status_row_1 td{background-color:#7FFFD4;}
-/*lead comments*/
+/* lead comments */
.comment p{padding:10px; background-color:#eee; border-bottom: 1px solid #ccc; margin-left:40px;}
.comment_box p{padding: 0px; margin-left:40px;}
.comment_box textarea{border: 1px solid #ccc; margin-bottom:10px;}
.action_bar {padding: 5px; background-color:#eee; margin-bottom:5px; -moz-border-radius: 5px;
-webkit-border-radius: 5x;
border-radius: 5px; }
-.action_bar label, .action_bar a{ line-height: 17px;}
+.action_bar label, .action_bar a{ line-height: 17px;}
+
+/* lead comments */
+#editor {
+ position: absolute;
+ height: 400px;
+}
@@ -15,32 +15,46 @@
var content = tmpl(view, {
template: d.data
});
-
+
var form = $('form', content),
- saveBtn = $('#save', content);
+ saveBtn = $('#save', content),
+ editor,
+ editorElm = $('#editor', content);
saveBtn.click(function(){
-
- var fromData = form.serialize();
-
- // Add page param.
- fromData = fromData + '&page=' + params.p1;
-
+
// Save to server.
service.send({
- data: fromData,
+ data: {
+ content: editor.getSession().getValue(),
+ page: params.p1
+ },
url: 'template/update',
success: function (d) {
// Show message.
MVC.message.show({text: 'Saved!', hideDealy: 2000});
}
});
-
+
return false;
});
callBack(content);
+
+ // Little timeout to make sure elements are covered.
+ var tt = setTimeout(function(){
+
+ // Height/width of editor.
+ var w = editorElm.width() - 30,
+ h = $(document).width() - 900;
+
+ // Set.
+ editorElm.width(w);
+ editorElm.height(h);
+
+ editor = ace.edit("editor");
+ }, 10);
}
});
}
@@ -59,7 +59,7 @@
success: function (d) {
// Show message.
- MVC.message.show({text: d.message, hideDealy: 2000});
+ MVC.message.show({text: 'Zone was saved!', hideDealy: 2000});
}
});
@@ -81,7 +81,7 @@
window.location.hash = 'Zone';
// Show message.
- MVC.message.show({text: d.message, hideDealy: 2000});
+ MVC.message.show({text: 'Zone was deleted.', hideDealy: 2000});
}
});
@@ -113,7 +113,7 @@
window.location.hash = 'Zone';
// Show message.
- MVC.message.show({text: d.message, hideDealy: 2000});
+ MVC.message.show({text: 'Zone was created!', hideDealy: 2000});
}
});
@@ -39,6 +39,8 @@
<script src="/admin/library/jquery/jquery.min.js" type="text/javascript"></script>
<script src="/admin/library/jquery/jquery.tmpl.min.js" type="text/javascript"></script>
<script src="/admin/library/jquery/jquery.MVC.js" type="text/javascript"></script>
+
+ <script src="/admin/library/ace/ace.js" type="text/javascript"></script>
<script src="/admin/library/MVC.util.js" type="text/javascript"></script>
<script src="/admin/library/MVC.util.string.js" type="text/javascript"></script>
@@ -71,19 +71,19 @@
MVC.service.get({
url: 'user/list',
success: function (d) {
-
+
// This is really unsecure!
- if(d.data.users.length !== 0){
+ if(d.data.users.length === 0){
var form = $('#login_form'),
- loginBtn = $('.submit', form),
+ loginBtn = $('.submit'),
createPageBtn = $('#createPage'),
goToAdminBtn = $('#goToAdmin');
if($.browser.msie){
form.html('<div><p style="text-align: center;"><strong>Vas prohlizec momentalne nepodporujeme!</strong><br />Podporujeme tyto prohlizece: Firefox, Chrome, Safari</p></div>');
}
-
+
// Bind save click.
loginBtn.click(function(){
Oops, something went wrong.
@@ -12,13 +12,10 @@
<div class="clearfix action_bar">
<a href="#null" class="button right submit margin_right_5" id="save">Save</a>
</div>
- <div class="padding_20">
-
- <p class="clearfix">
- <label for="name">
- Content</label>
- <textarea name="content">${template.content}</textarea>
- </p>
- </div><!-- 'padding' -->
+
+ <p class="clearfix">
+ <div name="content" id="editor" class="file-editor-textarea" rows="35" name="value" data-language="HTML" data-filename="detail.html">${template.content}</div>
+ </p>
+
</form>
</div>
View
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,5 @@
// Lib.
var tmpl = require('jqtpl'),
- ser = require('../lib/service'),
c = require('../../config'),
a = require('../lib/util.array'),
Mongolian = require("mongolian");
@@ -93,8 +92,11 @@ exports.get = function(obj, callBack){
callBack(obj.params);
} else if(obj.action === 'createcomment'){
+ // TODO: implement security.
+ //obj.params.comment
+
var now = new Date();
-
+
// Add date.
obj.params.date = now; //.toJSON();
@@ -1,6 +1,5 @@
// Lib.
var tmpl = require('jqtpl'),
- ser = require('../lib/service'),
c = require('../../config'),
a = require('../lib/util.array'),
Mongolian = require("mongolian");
@@ -112,14 +112,15 @@ exports.get = function(obj, callBack){
// Chew.
var newList = [];
- list.forEach(function(d, i){
-
- // Mute password.
- d.password = 'not telling you :)';
-
- newList.push(d);
- });
-
+ if(list){
+ list.forEach(function(d, i){
+
+ // Mute password.
+ d.password = 'not telling you :)';
+
+ newList.push(d);
+ });
+ }
callBack({users: newList});
});
} else if(obj.action === 'update'){
@@ -1,6 +1,5 @@
// Lib.
var tmpl = require('jqtpl'),
- ser = require('../lib/service'),
c = require('../../config'),
Mongolian = require("mongolian");
@@ -1,7 +1,6 @@
// Libs.
var tmpl = require('jqtpl'),
- ser = require('../lib/service'),
c = require('../../config'),
Mongolian = require("mongolian");
@@ -75,49 +74,4 @@ exports.get = function(params, view, callBack){
});
});
-
- /*
- ser.get('pages/detail', {url: pageUrl}, function(page){
-
- ser.get('zone/list', {}, function(zoneList){
-
- zones = zoneList.zone;
-
- // Merge model with template.
- var content = tmpl.tmpl(view, {page: page.page}, helpers);
-
- // Spit content.
- callBack(content);
- });
- });
-
- } else if(pageUrl === 'xxx'){
-
- // Get data through service layer.
- ser.get('hypoteky/list', {}, function(hypoteky){
-
- // Merge model with template.
- var content = tmpl.tmpl(view, hypoteky);
-
- // Spit content.
- callBack(content);
- });
-
- } else {
-
- //hypoteka-ceske-sporitelny
-
- // Get data through service layer.
- ser.get('hypoteky/detail', {pageUrl: pageUrl}, function(hypoteka){
-
- console.log(hypoteka);
-
- // Merge model with template.
- var content = tmpl.tmpl(view, hypoteka);
-
- // Spit content.
- callBack(content);
- });
- }
- */
};
View
Oops, something went wrong.
@@ -1,11 +1,13 @@
-
var fs = require('fs'),
c = require('../../config'),
querystring = require('querystring');
// Router.
exports.get = function(req, resp){
-
+
+ // TODO: implement security layer.
+ // (skip comment posting).
+
// To Get a Cookie.
var cookies = {};
req.headers.cookie && req.headers.cookie.split(';').forEach(function( cookie ) {
@@ -48,7 +50,7 @@ exports.get = function(req, resp){
if(req.method === 'POST'){
- var _REQUEST = { },
+ var _REQUEST = {},
_CONTENT = '';
req.addListener('data', function(chunk) {
Oops, something went wrong.

0 comments on commit 92ccabd

Please sign in to comment.