Commit 5134d8c1 authored by Oliver Schneider's avatar Oliver Schneider
Browse files

Anmelde Modal erstellt

parent 55ff74f5
......@@ -10,22 +10,22 @@
### File Structure:
* admin (Admintool)
* lib (Libraries)
* bootstrap
* jquery
* amiv (amivcore)
* cust (custom files)
* main.js (our js file)
* main.css (our css file)
* res (Resources)
* bg (big pictures and backgrounds)
* favicon
* fonts
* logo
* tools (tools)
* main.tool
* users.tool
* ...
* lib (Libraries)
* bootstrap
* jquery
* amiv (amivcore)
* cust (custom files)
* main.js (our js file)
* main.css (our css file)
* res (Resources)
* bg (big pictures and backgrounds)
* favicon
* fonts
* logo
* tools (tools)
* main.tool
* users.tool
* ...
* public (Website)
## Library ```tools```:
......@@ -35,10 +35,10 @@ The JS library ```tools``` is the backbone of the single tools. It enables the t
###### Displays an alert box to the user.
* ```msg /text,HTML``` The message or html to be displayed in the alert box
* ```type /('s', 'i', 'w', 'e')``` Specifies the type of message. Displays different colors for each type.
* s: success
* i: information
* w: warning
* e: error
* s: success
* i: information
* w: warning
* e: error
* ```timeout /int (optional)``` Number of milliseconds that the message will be displayed. If not specified the default time is 5s, or 5000ms.
##### Example:
......@@ -46,21 +46,21 @@ The JS library ```tools``` is the backbone of the single tools. It enables the t
* ``` tools.log('Error!', 'e', 10000); ``` Creates a gred alert box with the message specified that will disappear after 10s.
### modal(data)
###### Spwans a BS modal. To close a modal without a button just call ```tools.modalClose()```
###### Spawns a BS modal. To close a modal without a button just call ```tools.modalClose()```
* ```data /js object``` Object containning the infos
* ```head /text, HTML (optional)``` Sets the modal title.
* ```body /text, HTML (optional)``` Sets the modal body.
* ```button /object (optional)``` Buttons in the footer. (Multiple allowed!! :D)
* ```type /string (optional)``` Type of boostrap button
* primary
* success
* info
* warning
* danger
* link
* ```close /bool (optional)``` Close modal on click
* ```callback /function (optional)``` Callback for the button
* ```cancel /function (optional)``` Function called on cancel or modal is closed.
* ```head /text, HTML (optional)``` Sets the modal title.
* ```body /text, HTML (optional)``` Sets the modal body.
* ```button /object (optional)``` Buttons in the footer. (Multiple allowed!! :D)
* ```type /string (optional)``` Type of boostrap button
* primary
* success
* info
* warning
* danger
* link
* ```close /bool (optional)``` Close modal on click
* ```callback /function (optional)``` Callback for the button
* ```cancel /function (optional)``` Function called on cancel or modal is closed.
##### Example:
```javascript
......@@ -102,8 +102,8 @@ tools.modal({
#### menu(object)
###### Allows a tool to access the top menu and have custom links and callbacks.
* ```object /js object``` Menu structured element from which the menu is generated.
* ```link /link (optional)``` HTTP link or hash. If left empty the link is disabled.
* ```callback /function (optional)``` The function that is called if the link is pressed.
* ```link /link (optional)``` HTTP link or hash. If left empty the link is disabled.
* ```callback /function (optional)``` The function that is called if the link is pressed.
##### Example:
```javascript
......@@ -146,7 +146,7 @@ tools.ui.menu({
#### set(name, value)
###### Sets and stores a value. If the value already exists it will be overwritten!
* ```name /text``` Name of the 'variable'.
* ```value /any``` The data to be stored. Can be any valid JS data, object, etc.
* ```value /any``` The data to be stored. Can be any valid JS data, object, etc.
##### Example:
* ```tools.mem.session.set('currentUser', 'Sir Anon');``` Stores 'Sir Anon' in 'currentUser'.
......
......@@ -105,7 +105,7 @@
</div>
</div>
<!-- Modal -->
<!--Login Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-sm">
......@@ -113,7 +113,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Herzlich Wilkommen</h4>
<h4 class="modal-title">Herzlich Willkommen</h4>
</div>
<div class="modal-body">
<div class="input-group">
......@@ -127,7 +127,28 @@
<button type="submit" class="btn btn-primary loginAction" data-dismiss="modal" id="loginSubmit">Login</button>
</div>
</div>
</div>
</div>
<!-- Anmeldung Modal -->
<div id="anmeldeModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Gratulation - Du bist angemeldet!</h4>
</div>
<div class="modal-body eventdets" id="eventdets">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary loginAction" data-dismiss="modal" id="regSubmit">Bestätigungsmail erneut senden</button>
<button type="submit" class="btn btn-primary loginAction" data-dismiss="modal" id="regSubmit">Abmelden</button>
<button type="submit" class="btn btn-primary loginAction" data-dismiss="modal" id="regSubmit">Sowas von dabei!</button>
</div>
</div>
</div>
</div>
......
......@@ -27,7 +27,9 @@ function getEvents(callback) {
return;
}
console.log(item.title_de);
if (item.time_start == null){
$('.datum').remove();
}
/*Picture Checker*/
if (item.img_banner == null){
item.img_banner = "https://s-media-cache-ak0.pinimg.com/736x/9c/24/fd/9c24fdb71c67e31efef540efb141f96d.jpg";
......@@ -48,11 +50,19 @@ function getEvents(callback) {
var regend = new Date(item.time_register_end);
var heute = new Date(Date.now());
var register = "";
if (item.spots>=0 && regstart<=heute && regend>=heute){
if (item.spots>=0 && regstart<=heute && regend>=heute && item.allow_email_signup==false){
register = "Anmelden";
$('.eventdets').append('<div class="card-content">'+item.description_de+'</div>');
} else if (item.spots>=0 && regstart<=heute && regend>=heute){
console.log(amivcore.authenticated());
console.log("yolo");
if(amivcore.authenticated()){
register = "Anmelden";
$('.eventdets').append('<div class="card-content">'+item.description_de+'</div>');
}
}
addElement('<div class="card"><div class="card-image"><img class="img-responsive" src="'+item.img_banner+'"><date><div class="month">'+month[datenum.getMonth()]+'</div><div class="day">'+datenum.getDate()+'</div><div class="starttime">'+datenum.getHours()+':'+minutes+'</div><date-overlay></date-overlay></date><span class="card-title">'+item.title_de+' @ '+item.location+'</span></div><div class="card-content">'+item.description_de+'</div><div class="card-action"><a href="#" target="new_blank">Info</a><a href="#" target="new_blank">'+register+'</a><a href="#" target="new_blank">Im Kalender speichern</a></div></div>');
addElement('<div class="card"><div class="card-image"><img class="img-responsive" src="'+item.img_banner+'"><date class="datum"><div class="month">'+month[datenum.getMonth()]+'</div><div class="day">'+datenum.getDate()+'</div><div class="starttime">'+datenum.getHours()+':'+minutes+'</div><date-overlay></date-overlay></date><span class="card-title">'+item.title_de+' @ '+item.location+'</span></div><div class="card-content">'+item.description_de+'</div><div class="card-action"><a href="#" target="new_blank">Info</a><a href="#" id="anmeldeSub" target="new_blank" data-toggle="modal" data-target="#anmeldeModal">'+register+'</a><a href="#" target="new_blank">Im Kalender speichern</a></div></div>');
});
});
});
......@@ -60,7 +70,7 @@ function getEvents(callback) {
$('#loginSubmit').on('click', function(){
amivcore.login($('#loginUsername').val(), $('#loginPassword').val(), function(ret) {
if (ret == true){
$('.welcomening').append('<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">+amivcore.user+<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="#">Logout</a></li><li role="separator" class="divider"></li><li><a href="https://intern.amiv.ethz.ch/wiki/">AMIV-Tools</a></li></ul></li>');
$('.welcomening').append('<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">+amivcore.user()+<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="#">Logout</a></li><li role="separator" class="divider"></li><li><a href="https://intern.amiv.ethz.ch/wiki/">AMIV-Tools</a></li></ul></li>');
$('.loglogbutton').hide();
} else {
......@@ -73,4 +83,5 @@ function getEvents(callback) {
});
// Eventanmeldung
$('#anmeldeSub').on('click');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment