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

Moznost zviditelnit meno studenta pri prihlasovani na skusku #159

Open
wants to merge 5 commits into
base: master
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
1 change: 0 additions & 1 deletion fladgejt/rest/studium.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ def get_zapisne_listy(self, studium_key):
datum_zapisu=row['datumZapisu'],
studium_key=studium_key)
for row in zapisne_listy]

return result
7 changes: 6 additions & 1 deletion fladgejt/webui/terminy.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __process_prihlaseni_studenti_list(self, app, ops):

return result

def prihlas_na_termin(self, termin_key):
def prihlas_na_termin(self, termin_key, zverejnit_meno):
zapisny_list_key, predmet_key, datum, cas, miestnost, poznamka = (
decode_key(termin_key))

Expand All @@ -237,6 +237,11 @@ def prihlas_na_termin(self, termin_key):
app.d.zoznamTerminovTable.all_rows(),
dat=datum, cas=cas, miestnosti=miestnost, poznamka=poznamka))


# Ak chceme zverejnit meno pri skuske, klikneme checkbox.
if zverejnit_meno:
app.d.suhlasZobrazCheckBox.set_to(True)

# Stlacime OK.
with app.collect_operations() as ops:
app.d.enterButton.click()
Expand Down
5 changes: 5 additions & 0 deletions votrfront/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ a, .btn.btn-link {
margin-left: 10px;
}

.publish-name-checkbox {
margin-left: 20px;
width: 60%;
}

/* "html" = specificity tie breaker */
/* must win vs ".rbc-calendar", ".rbc-event", ".rbc-event.rbc-selected" */
html .skusky-calendar {
Expand Down
32 changes: 29 additions & 3 deletions votrfront/js/MojeSkuskyPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import PropTypes from 'prop-types';
import PropTypes, { func } from 'prop-types';
import React from 'react';
import _ from 'lodash';
import { saveAs } from 'file-saver';
Expand Down Expand Up @@ -207,6 +207,28 @@ export function MojeSkuskyMenu() {
});
}

export class PublishNameCheckbox extends React.Component {

static state = false;

render() {
return (
<div className="pull-left">
<div className="publish-name-checkbox">
<input
type="checkbox"
id="publish-name-checkbox-input"
name="publish-name-checkbox-input"
onClick={() => {PublishNameCheckbox.state = document.getElementById("publish-name-checkbox-input").checked}}
/>
<label htmlFor="publish-name-checkbox-input"> Po prihlásení sa na skúšku zverejniť moje meno v zozname prihlásených.</label>
</div>
</div>
);
}
}


function convertToEvents(terminy){
return terminy.map((termin, i) => {
return {id: i,
Expand Down Expand Up @@ -331,10 +353,13 @@ export class SkuskyRegisterButton extends React.Component {
}

handleClick = () => {
var command = this.isSigninButton() ? 'prihlas_na_termin' : 'odhlas_z_terminu';
var isSigninButton = this.isSigninButton();
var command = isSigninButton ? 'prihlas_na_termin' : 'odhlas_z_terminu';
var termin = this.props.termin;
var publishName = PublishNameCheckbox.state;
var args = isSigninButton ? [termin.termin_key, publishName] : [termin.termin_key]

sendRpc(command, [termin.termin_key], (message) => {
sendRpc(command, args, (message) => {
if (message) {
this.setState({ pressed: false });
alert(message);
Expand Down Expand Up @@ -383,6 +408,7 @@ export function MojeSkuskyPage() {
<div className="header">
<PageTitle>Moje skúšky</PageTitle>
<MojeSkuskyMenu />
<PublishNameCheckbox.prototype.render />
</div>
<MojeSkuskyPageContent />
</ZapisnyListSelector>
Expand Down
Loading