Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
b3b8e2bc
Commit
b3b8e2bc
authored
Nov 11, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msgbox directive
parent
0e38699b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
21 deletions
+61
-21
list.html
app/components/crud/templates/list.html
+11
-11
directives.js
app/shared/directives.js
+12
-0
msgbox.html
app/shared/templates/directives/msgbox.html
+13
-0
sidebar.html
app/shared/templates/directives/sidebar.html
+1
-1
form_service.js
app/zetalib/forms/form_service.js
+24
-9
No files found.
app/components/crud/templates/list.html
View file @
b3b8e2bc
...
...
@@ -13,15 +13,15 @@
<table
class=
"table table-bordered"
style=
"background-color:#fff;"
>
<thead>
<tr>
<t
h
colspan=
"2"
>
<t
d
colspan=
"2"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
Hepsini Seç
</label>
</t
h
>
<t
h
ng-repeat=
"value in nobjects[0]"
ng-if=
"nobjects[0]!='-1'"
>
{{ value }}
</th
>
<t
h
ng-if=
"nobjects[0]=='-1'"
>
{{ model }}
</th
>
<t
h>
action
</th
>
</t
d
>
<t
d
ng-repeat=
"value in nobjects[0]"
ng-if=
"nobjects[0]!='-1' && !$last"
>
{{ value }}
</td
>
<t
d
ng-if=
"nobjects[0]=='-1'"
>
{{ model }}
</td
>
<t
d>
action
</td
>
</tr>
</thead>
<tbody>
...
...
@@ -31,18 +31,18 @@
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
</label>
</td>
<t
h
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</th
>
<t
d
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</td
>
<!-- below 2 of object will not be listed there for ng repeat loops 2 less -->
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>
1
"
>
<a
ng-href=
"{{object[
2
].detailLink}}"
>
{{object[1]}}
</a>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>
0 && !$last
"
>
<a
ng-href=
"{{object[
object.length-1
].detailLink}}"
>
{{object[1]}}
</a>
</td>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>
1
"
>
<a
ng-href=
"{{object[
2
].detailLink}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>
0 && !$last
"
>
<a
ng-href=
"{{object[
object.length-1
].detailLink}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<span
ng-if=
"$index!=1"
>
{{object[key]}}
</span>
</td>
<td>
<a
ng-href=
"{{object[
2
].editLink}}"
>
Edit
</a>
<a
ng-href=
"{{object[
object.length-1
].editLink}}"
>
Edit
</a>
<br>
</td>
</tr>
...
...
app/shared/directives.js
View file @
b3b8e2bc
...
...
@@ -324,6 +324,18 @@ app.directive('notifications', function () {
};
});
/**
* msgbox directive
*/
app
.
directive
(
'msgbox'
,
function
()
{
return
{
templateUrl
:
'shared/templates/directives/msgbox.html'
,
restrict
:
'E'
,
replace
:
true
};
});
/**
* search directive in sidebar
*/
...
...
app/shared/templates/directives/msgbox.html
0 → 100644
View file @
b3b8e2bc
<div
class=
""
>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
{{msgbox.title}}
</div>
<div
class=
"panel-body"
>
<p>
{{msgbox.msg}}
</p>
</div>
<!--<div class="panel-footer">-->
<!--</div>-->
</div>
</div>
\ No newline at end of file
app/shared/templates/directives/sidebar.html
View file @
b3b8e2bc
<div
class=
"navbar-default sidebar"
role=
"navigation"
ng-mouseenter=
"openSidebar()"
ng-mouseleave=
"closeSidebar()"
>
<div
class=
"brand"
>
<a
href=
""
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
<a
href=
"
#/dashboard
"
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
</div>
<div
class=
"sidebar-nav navbar-collapse"
>
...
...
app/zetalib/forms/form_service.js
View file @
b3b8e2bc
...
...
@@ -7,7 +7,7 @@
var
form_generator
=
angular
.
module
(
'formService'
,
[
'general'
]);
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$location
,
RESTURL
,
FormDiff
,
$rootScope
)
{
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$location
,
$compile
,
RESTURL
,
FormDiff
,
$rootScope
)
{
var
generator
=
{};
generator
.
makeUrl
=
function
(
scope
)
{
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
...
...
@@ -61,15 +61,18 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
}
});
debugger
;
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
)
{
// generically change _id fields model value
if
(
k
==
scope
.
form_params
.
param
)
{
scope
.
model
[
k
]
=
scope
.
form_params
.
id
;
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
return
;
if
(
'form_params'
in
scope
)
{
if
(
k
==
scope
.
form_params
.
param
)
{
scope
.
model
[
k
]
=
scope
.
form_params
.
id
;
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
return
;
}
}
if
(
v
.
type
===
'select'
)
{
...
...
@@ -261,8 +264,9 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
}
if
(
value
!==
'-1'
)
{
value
[
2
]
=
{
detailLink
:
makelink
(
"detail/"
),
editLink
:
makelink
(
"edit/"
)}
;
value
.
push
({
detailLink
:
makelink
(
"detail/"
),
editLink
:
makelink
(
"edit/"
)})
;
}
console
.
log
(
value
);
});
};
generator
.
get_form
=
function
(
scope
)
{
...
...
@@ -346,22 +350,33 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
//data.form = get_diff;
}
//debugger;
return
$http
.
post
(
generator
.
makeUrl
(
$scope
),
data
)
.
success
(
function
(
data
)
{
// if return data consists forms key then tr
o
gger redraw the form with updated data
// if return data consists forms key then tr
i
gger redraw the form with updated data
if
(
data
.
forms
)
{
delete
$scope
.
form
,
$scope
.
model
,
$scope
.
schema
,
$scope
.
form_params
.
cmd
;
generator
.
generate
(
$scope
,
data
);
$scope
.
$broadcast
(
'schemaFormRedraw'
)
}
// if submit returns nobjects after save
if
(
data
.
nobjects
)
{
generator
.
itemLinksGenerator
(
$scope
,
data
);
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
$location
.
path
(
'/crud/'
+
$scope
.
form_params
.
model
+
'/list'
).
search
(
angular
.
fromJson
(
data
));
}
// if submit returns msgbox after save
if
(
data
.
msgbox
)
{
$scope
.
msgbox
=
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox ></msgbox>"
)(
$scope
);
//debugger;
angular
.
element
(
document
.
querySelector
(
'.main.ng-scope'
)).
children
().
remove
();
angular
.
element
(
document
.
querySelector
(
'.main.ng-scope'
)).
append
(
newElement
);
}
});
};
return
generator
;
...
...
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