diff --git a/js/mustache.js b/js/mustache.js deleted file mode 100644 index 14b3e43..0000000 --- a/js/mustache.js +++ /dev/null @@ -1,65 +0,0 @@ -/** @version 0.4.0 */ -function mustache(template, self, parent, invert) { - var render = mustache - var output = "" - var i - - function get (ctx, path) { - path = path.pop ? path : path.split(".") - ctx = ctx[path.shift()] || "" - return (0 in path) ? get(ctx, path) : ctx - } - - self = Array.isArray(self) ? self : (self ? [self] : []) - self = invert ? (0 in self) ? [] : [1] : self - - for (i = 0; i < self.length; i++) { - var childCode = '' - var depth = 0 - var inverted - var ctx = (typeof self[i] == "object") ? self[i] : {} - ctx.prototype = parent - ctx[""] = {"": self[i]} - - template.replace(/([\s\S]*?)({{((\/)|(\^)|#)(.*?)}}|$)/g, - function(match, code, y, z, close, invert, name) { - if (!depth) { - output += code.replace(/{{{(.*?)}}}|{{(!?)(&?)(>?)(.*?)}}/g, - function(match, raw, comment, isRaw, partial, name) { - return raw ? get(ctx, raw) - : isRaw ? get(ctx, name) - : partial ? render(get(ctx, name), ctx) - : !comment ? new Option(get(ctx, name)).innerHTML - : "" - } - ) - inverted = invert - } else { - childCode += depth && !close || depth > 1 ? match : code - } - if (close) { - if (!--depth) { - name = get(ctx, name) - if (/^f/.test(typeof name)) { - output += name.call(ctx, childCode, function (template) { - return render(template, ctx) - }) - } else { - output += render(childCode, name, ctx, inverted) - } - childCode = "" - } - } else { - ++depth - } - } - ) - //dereference prototype - /* - if (Object.getPrototypeOf(ctx) == Object.prototype){ - delete ctx.prototype; - delete ctx[""] - }*/ - } - return output -} diff --git a/js/team-add.js b/js/team-add.js index ee81211..3ba93cd 100644 --- a/js/team-add.js +++ b/js/team-add.js @@ -10,10 +10,9 @@ app.page("team-add", function() e.preventDefault(); if (nameInput.value.length>0){ TeamRepository.save({ "name": nameInput.value}); - //refresh view - //hack:..., not compatible old browser grrr..... - history.pushState(null, null, "#team-list"); - app("team-list"); + + history.back(); + }else { //handle error msg } diff --git a/js/team-member-details.js b/js/team-member-details.js index 7f435b1..5018ca0 100644 --- a/js/team-member-details.js +++ b/js/team-member-details.js @@ -12,19 +12,24 @@ app.page("team-member-details", function() e.preventDefault(); var member = TeamRepository.findById(parseInt($id.value)); member.name = $name.value; - TeamRepository.save(member); - history.pushState(null, null, "#team-list"); - app("team-list"); + history.back(); + //history.pushState(null, null, "#team-list"); + //app("team-list"); } removeBtn.onclick = function(e){ e.preventDefault(); - TeamRepository.remove(parseInt($id.value)); - //TODO handle error - history.pushState(null, null, "#team-list"); - app("team-list"); + var res = window.confirm("are you sure you want to remove "+ $name.value); + if (res){ + TeamRepository.remove(parseInt($id.value)); + //TODO handle error + history.back(); + } + + //history.pushState(null, null, "#team-list"); + //app("team-list"); } // present the view - load data and show: diff --git a/styles/app.css b/styles/app.css index 6a619e5..33e5344 100644 --- a/styles/app.css +++ b/styles/app.css @@ -14,6 +14,7 @@ h3 { font-size: 1em; } background-color: #D9EDF7; color:#31708f; border: 1px solid #31708f; + border-radius: 4px; } .alert-closebtn { margin:2px; @@ -117,6 +118,11 @@ ul.topnav li.icon {display: none;} text-align: left; } } +.link-home { + color:#000; + text-decoration: none; + padding-right: 12px; +} /***end menu style**/ select{ diff --git a/tpl/team-add.html b/tpl/team-add.html index 90a1e1f..f7ea98a 100644 --- a/tpl/team-add.html +++ b/tpl/team-add.html @@ -1,5 +1,5 @@
-

Add a member

+

Add a member

diff --git a/tpl/team-member-details.html b/tpl/team-member-details.html index 16584ba..113827e 100644 --- a/tpl/team-member-details.html +++ b/tpl/team-member-details.html @@ -1,5 +1,5 @@
-

Member Details

+

Member Details