Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mod button in advance option added #105

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions client/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,30 @@ a {
font-weight: 600;
}

.plusbuttoncontainer {
.instancemodsminus {
cursor: pointer;
background-color: red;
color: white;
text-align: center;
font-weight: 600;
width: 31px;
float: left;
height: 30px;
margin: 10px;
border-radius: 5px;
font-size: 23px;
}

.buttoncontainer {
width: 51px;
height: 50px;
display: inline;
}

#recent {
padding-bottom: 45px;
}


.modinputfield {
padding-bottom: 2em;
}
6 changes: 3 additions & 3 deletions client/views/create/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<input id="instancedescriptioninput" type="text" placeholder="Description...">
</div>
<div id="instancebottominputcontainer">
<input class="instancemodsinput firstmodinput" type="email" placeholder="Moderator email...">
<div class="emptyinputspacer lastinputspacer">
<div class="plusbuttoncontainer firstmodinput">
<div class="modinputfield">
<input class="instancemodsinput" type="email" placeholder="Moderator email...">
<div class="buttoncontainer">
<div class="instancemodsplus">
+
</div>
Expand Down
28 changes: 20 additions & 8 deletions client/views/create/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,31 @@ Template.create.events({
}
},
'click .instancemodsplus': function (event, template) {
const spacers = document.getElementsByClassName('emptyinputspacer');
if (spacers.length < 4) {
$('.instancemodsinput').removeClass('lastmodinput');
$('.plusbuttoncontainer').removeClass('lastmodinput');
$('.instancemodsplus').remove();
$('<input class="instancemodsinput lastmodinput" type="text" placeholder="Moderator email..."><div class="emptyinputspacer lastinputspacer"><div class="plusbuttoncontainer"><div class="instancemodsplus">+</div></div></div>').insertAfter('.lastinputspacer').last();
$('.lastinputspacer').first().removeClass('lastinputspacer');
$('#instancebottominputcontainer').height((index, height) => (height + 50));
const modfields = document.getElementsByClassName('modinputfield');
let addinputfield = true;
if (modfields.length < 4) {
for (let inputindex = 0; inputindex < modfields.length; inputindex++) {
if (modfields[inputindex].children[0].value === '') {
showCreateError('Fill in the exisitng input fields before creating a new one.');
addinputfield = false;
break;
}
}
if (addinputfield === true) {
$('.instancemodsplus').remove();
$('.buttoncontainer').last().append('<div class="instancemodsminus" >x</div>');
$('<div class="modinputfield"><input class="instancemodsinput" type="text" placeholder="Moderator email..."><div class="buttoncontainer"><div class="instancemodsplus">+</div></div></div>').insertAfter($('.modinputfield').last());
$('#instancebottominputcontainer').height((index, height) => (height + 50));
}
} else {
showCreateError("You've reached the maximum # of moderators (4).");
return false;
}
},
'click .instancemodsminus': function (event, template) {
event.originalEvent.path[2].remove();
$('#instancebottominputcontainer').height((index, height) => (height - 50));
},
'click #buttonarea': function (event, template) {
if (!Meteor.user()) {
return false;
Expand Down
6 changes: 0 additions & 6 deletions client/views/main/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ $screen-md: 992px;
border-bottom: 1px solid #e3e3e3;
}

.emptyinputspacer {
float: right;
height: 2em;
}


.instancemodsinput {
float: left;
width: 70%;
Expand Down