Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6a4b7745
authored
Apr 27, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
supervisor editing solved
#78
parent
62dcf558
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
15 deletions
sails/src/assets/scripts/config.js
sails/src/assets/scripts/modules/admin/controllers/supervisors.js
sails/src/assets/scripts/modules/admin/views/supervisors_add.html
sails/src/assets/scripts/modules/admin/views/supervisors_update.html
sails/src/assets/scripts/modules/login/views/signin.html
sails/src/assets/scripts/config.js
View file @
6a4b7745
/* global angular */
angular
.
module
(
'dashboardConfig'
,
[]).
constant
(
'config'
,
{
backend
:
'http
s
://'
+
window
.
location
.
host
,
backend
:
'http://'
+
window
.
location
.
host
,
});
sails/src/assets/scripts/modules/admin/controllers/supervisors.js
View file @
6a4b7745
...
...
@@ -14,11 +14,14 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
surname
:
''
,
address
:
''
,
country
:
''
,
postalCode
:
''
,
email
:
''
,
phone
:
''
,
gender
:
'F'
,
lang
:
'es'
,
office
:
''
office
:
''
,
password
:
''
,
password_confirm
:
''
};
// List of supervisors
...
...
@@ -53,11 +56,14 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
surname
:
''
,
address
:
''
,
country
:
''
,
postalCode
:
''
,
email
:
''
,
phone
:
''
,
gender
:
'F'
,
lang
:
'es'
,
office
:
''
office
:
''
,
password
:
''
,
password_confirm
:
''
};
// Hide the form
...
...
@@ -78,11 +84,14 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
name
:
supervisor
.
name
,
surname
:
supervisor
.
surname
,
address
:
supervisor
.
address
,
postalCode
:
supervisor
.
address
,
country
:
supervisor
.
country
,
email
:
supervisor
.
email
,
actualEmail
:
supervisor
.
email
,
phone
:
supervisor
.
phone
,
gender
:
supervisor
.
gender
,
password
:
supervisor
.
password
,
password_confirm
:
supervisor
.
password_confirm
,
lang
:
supervisor
.
lang
,
office
:
supervisor
.
office
};
...
...
@@ -94,7 +103,7 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
// Checking new email
// If no change, it is deleted from supervisor object
if
(
supervisor
.
email
==
supervisor
.
actualEmail
){
if
(
supervisor
.
email
==
supervisor
.
actualEmail
){
delete
supervisor
.
email
;
delete
supervisor
.
actualEmail
;
}
...
...
@@ -103,6 +112,14 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
var
supid
=
supervisor
.
id
;
delete
supervisor
.
id
;
if
(
supervisor
.
password
!=
supervisor
.
password_confirm
)
return
;
if
(
supervisor
.
password
.
length
==
0
)
{
delete
supervisor
.
password
;
delete
supervisor
.
password_confirm
;
}
$http
.
put
(
config
.
backend
+
'/sup/'
+
supid
,
supervisor
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
...
...
@@ -122,6 +139,9 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
$scope
.
supervisors
[
i
].
gender
=
data
.
gender
;
$scope
.
supervisors
[
i
].
lang
=
data
.
lang
;
$scope
.
supervisors
[
i
].
office
=
data
.
office
;
$scope
.
supervisors
[
i
].
postalCode
=
data
.
postalCode
;
$scope
.
supervisors
[
i
].
password
=
''
;
$scope
.
supervisors
[
i
].
password_confirm
=
''
;
}
}
...
...
@@ -142,7 +162,13 @@ dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisor
var
supervisor
=
$scope
.
formdatasupervisor
;
// Add password
supervisor
.
password
=
supervisor
.
name
+
supervisor
.
email
;
if
(
supervisor
.
password
!=
supervisor
.
password_confirm
)
return
;
if
(
supervisor
.
password
.
length
==
0
)
{
delete
supervisor
.
password
;
delete
supervisor
.
password_confirm
;
}
$http
.
post
(
config
.
backend
+
'/sup'
,
supervisor
)
...
...
sails/src/assets/scripts/modules/admin/views/supervisors_add.html
View file @
6a4b7745
...
...
@@ -14,7 +14,11 @@
<input
type=
"text"
class=
"form-control"
id=
"supervisor_address"
placeholder=
"{{ 'address' | translate }}"
ng-model=
"formdatasupervisor.address"
/>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
id=
"supervisor_postal_code"
placeholder=
"{{ 'postal_code' | translate }}"
required
ng-model=
"formdata.postal_code"
ng-change=
"formdata.postal_code = formdata.postal_code.toUpperCase()"
/>
</div>
<div
class=
"form-group"
>
<label
translate
>
country
</label>
<select
class=
"form-control"
name=
"supervisor_country"
id=
"supervisor_country"
ng-model=
"formdatasupervisor.country"
required
>
<option
value=
"ES"
selected
>
España
</option>
...
...
@@ -39,7 +43,7 @@
</div>
<fieldset>
<l
egend
translate
>
office
</legend
>
<l
abel
translate
>
office
</label
>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"supervisor_office"
id=
"supervisor_office"
ng-model=
"formdatasupervisor.office"
required
>
<option
ng-repeat=
"of in offices | orderBy: 'name'"
value=
"{{ of.id }}"
>
...
...
@@ -50,7 +54,7 @@
</fieldset>
<fieldset>
<l
egend
translate
>
language
</legend
>
<l
abel
translate
>
language
</label
>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"supervisor_language"
id=
"supervisor_language"
ng-model=
"formdatasupervisor.lang"
>
<option
value=
"es"
selected
>
Español
</option>
...
...
@@ -59,6 +63,17 @@
</div>
</fieldset>
<fieldset>
<label
translate
>
password
</label>
<span
class=
"color_red text_sm pull-right"
ng-show=
"formdata.password != formdata.password_confirm"
translate
>
password_match
</span>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
id=
"supervisor_password1"
placeholder=
"{{ 'password_type' | translate }}"
required
ng-model=
"formdatasupervisor.password"
/>
</div>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
id=
"supervisor_password2"
placeholder=
"{{ 'password_confirm' | translate }}"
required
ng-model=
"formdatasupervisor.password_confirm"
/>
</div>
</fieldset>
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn btn-default"
ng-click=
"resetForm()"
>
{{'cancel'|translate}}
</button>
<button
type=
"submit"
class=
"btn btn-primary"
translate
>
add
</button>
...
...
sails/src/assets/scripts/modules/admin/views/supervisors_update.html
View file @
6a4b7745
<h3
translate
>
update_supervisor
</h3>
<form
name=
"UpdateSupervisorForm"
role=
"form"
ng-submit=
"save_supervisor()"
>
<fieldset>
<div
class=
"form-group"
>
...
...
@@ -14,7 +14,11 @@
<input
type=
"text"
class=
"form-control"
id=
"supervisor_address"
placeholder=
"{{ 'address' | translate }}"
ng-model=
"formdatasupervisor.address"
/>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
id=
"supervisor_postal_code"
placeholder=
"{{ 'postal_code' | translate }}"
required
ng-model=
"formdata.postalCode"
ng-change=
"formdata.postalCode = formdata.postalCode.toUpperCase()"
/>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
id=
"supervisor_country"
placeholder=
"{{ 'country' | translate }}"
ng-model=
"formdatasupervisor.country"
/>
</div>
...
...
@@ -34,7 +38,7 @@
</div>
<fieldset>
<l
egend
translate
>
office
</legend
>
<l
abel
translate
>
office
</label
>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"supervisor_office"
id=
"supervisor_office"
ng-model=
"formdatasupervisor.office"
>
<option
ng-repeat=
"of in offices | orderBy: 'name'"
value=
"{{ of.id }}"
>
...
...
@@ -45,7 +49,7 @@
</fieldset>
<fieldset>
<l
egend
translate
>
language
</legend
>
<l
abel
translate
>
language
</label
>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"supervisor_language"
id=
"supervisor_language"
ng-model=
"formdatasupervisor.lang"
>
<option
value=
"es"
>
Español
</option>
...
...
@@ -54,9 +58,20 @@
</div>
</fieldset>
<fieldset>
<label
translate
>
password
</label>
<span
class=
"color_red text_sm pull-right"
ng-show=
"formdata.password != formdata.password_confirm"
translate
>
password_match
</span>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
id=
"supervisor_password1"
placeholder=
"{{ 'password_type' | translate }}"
ng-model=
"formdatasupervisor.password"
/>
</div>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
id=
"supervisor_password2"
placeholder=
"{{ 'password_confirm' | translate }}"
ng-model=
"formdatasupervisor.password_confirm"
/>
</div>
</fieldset>
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn btn-default"
ng-click=
"resetForm()"
>
{{'cancel'|translate}}
</button>
<button
type=
"submit"
class=
"btn btn-primary"
translate
>
save
</button>
</div>
</fieldset>
</form>
\ No newline at end of file
</form>
sails/src/assets/scripts/modules/login/views/signin.html
View file @
6a4b7745
...
...
@@ -106,7 +106,7 @@
</div>
</div>
</div>
<fieldset>
<
/
fieldset>
<fieldset>
<div
class=
"form-group"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment