diff --git a/package.json b/package.json index ea879856..a484ba49 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "short code" ], "author": "Dick Choi (http://kazup.co)", - "license": "ISC", + "license": "No License", "bugs": { "url": "https://github.com/Rokt33r/codexen-app/issues" }, diff --git a/src/config/states.js b/src/config/states.js index 1deeb60d..d84f2f7e 100644 --- a/src/config/states.js +++ b/src/config/states.js @@ -27,6 +27,16 @@ angular.module('codexen') controller: 'AuthSignInController as vm' }) + .state('settings', { + url: '/settings', + views: { + 'main-view': { + templateUrl: 'tpls/states/settings.tpl.html', + controller: 'SettingsController as vm' + } + } + }) + /* Snippets */ .state('snippets', { url: '/snippets', diff --git a/src/controllers/states/SettingsController.js b/src/controllers/states/SettingsController.js new file mode 100644 index 00000000..d09e9f77 --- /dev/null +++ b/src/controllers/states/SettingsController.js @@ -0,0 +1,33 @@ +/* global angular */ +angular.module('codexen') + .controller('SettingsController', function (Settings) { + var vm = this + + vm.changePassword = changePassword + vm.isSuccess = false + vm.isError = false + + function changePassword () { + var params = { + password: vm.password, + newPassword: vm.newPassword + } + + Settings.changePassword(params) + .success(function (data) { + resetInput() + vm.isSuccess = true + vm.isError = false + }) + .error(function () { + resetInput() + vm.isError = true + vm.isSuccess = false + }) + } + + function resetInput () { + vm.password = '' + vm.newPassword = '' + } + }) diff --git a/src/services/Settings.js b/src/services/Settings.js new file mode 100644 index 00000000..bed4a943 --- /dev/null +++ b/src/services/Settings.js @@ -0,0 +1,13 @@ +/* global angular */ +angular.module('codexen') + .factory('Settings', function ($http, apiUrl) { + var changePassword = function (params) { + var url = apiUrl + 'settings/change_password' + + return $http.post(url, params) + } + + return { + changePassword: changePassword + } + }) diff --git a/src/styles/_index.styl b/src/styles/_index.styl index b19f0eca..d1f112c2 100644 --- a/src/styles/_index.styl +++ b/src/styles/_index.styl @@ -21,6 +21,9 @@ h1, h2, h3, h4, h5 textarea resize: vertical +hr + border-color $baseBorderColor + #side-view position:absolute top: 0 diff --git a/src/styles/states/settings.styl b/src/styles/states/settings.styl new file mode 100644 index 00000000..156ee4fa --- /dev/null +++ b/src/styles/states/settings.styl @@ -0,0 +1,8 @@ +.settings-state + .panel + margin-top 15px + h1 + margin 30px 0 + .section + h4 + margin-bottom 15px diff --git a/src/tpls/directives/side-nav.tpl.html b/src/tpls/directives/side-nav.tpl.html index 28faef60..d0dc9046 100644 --- a/src/tpls/directives/side-nav.tpl.html +++ b/src/tpls/directives/side-nav.tpl.html @@ -3,7 +3,7 @@ - + diff --git a/src/tpls/states/settings.tpl.html b/src/tpls/states/settings.tpl.html new file mode 100644 index 00000000..febf471d --- /dev/null +++ b/src/tpls/states/settings.tpl.html @@ -0,0 +1,33 @@ +
+
+
+

Settings

+

+ Some settings... +

+
+
+

Change Password

+
+ + Successfully changed!! + + + Request failed!! + +
+ + +
+
+ + +
+
+ +
+
+
+
+
+