mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-24 01:54:02 +02:00
feat: Add conference manager (#71)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
"user_not_found": "The current user is not found in the database",
|
||||
"not_connected": "User is not connected",
|
||||
"page_not_supported_on_different_branch": "Anonymized GitHub pages are only supported on the same branch.",
|
||||
"page_not_activated": "Anonymized GitHub page is not enabled."
|
||||
"page_not_activated": "Anonymized GitHub page is not enabled.",
|
||||
"conf_not_activated": "The conference is not activated."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +129,11 @@
|
||||
id="commit"
|
||||
name="commit"
|
||||
ng-model="source.commit"
|
||||
required
|
||||
ng-class="{'is-invalid': anonymize.commit.$invalid}"
|
||||
/>
|
||||
<small class="form-text text-muted"
|
||||
>The commit to anonymize</small
|
||||
>The commit to anonymize.</small
|
||||
>
|
||||
</div>
|
||||
<!-- Repo ID -->
|
||||
@@ -173,9 +175,10 @@
|
||||
rows="3"
|
||||
ng-model="terms"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
ng-class="{'is-invalid': anonymize.terms.$invalid}"
|
||||
></textarea>
|
||||
<small id="termsHelp" class="form-text text-muted"
|
||||
>One term per line. Each term will be replaced by XXX</small
|
||||
>One term per line. Each term will be replaced by XXX.</small
|
||||
>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
@@ -194,10 +197,24 @@
|
||||
id="conference"
|
||||
name="conference"
|
||||
ng-model="conference"
|
||||
ng-class="{'is-invalid': anonymize.conference.$invalid}"
|
||||
/>
|
||||
<small class="form-text text-muted"
|
||||
<small class="form-text text-muted" ng-show="!conference_data"
|
||||
>In which conference the paper will be submitted.</small
|
||||
>
|
||||
<small class="form-text text-muted" ng-show="conference_data"
|
||||
><a ng-href="{{conference_data.url}}" target="_target"
|
||||
>{{conference_data.name}}</a
|
||||
>
|
||||
will expire on {{conference_data.endDate | date}}.</small
|
||||
>
|
||||
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="anonymize.conference.$error.activated"
|
||||
>
|
||||
The conference is not activated.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion mb-3" id="options">
|
||||
@@ -341,10 +358,11 @@
|
||||
<small class="form-text text-muted"
|
||||
>How the repository will be anonymized. Stream mode will
|
||||
request the content on the flight. This is the only
|
||||
option for repositories bigger than {{site_options.MAX_REPO_SIZE * 1024| humanFileSize}}. Download will
|
||||
download the repository the repository on the
|
||||
anonymous.4open.science server, it is faster and offer
|
||||
more features.</small
|
||||
option for repositories bigger than
|
||||
{{site_options.MAX_REPO_SIZE * 1024| humanFileSize}}.
|
||||
Download will download the repository the repository on
|
||||
the anonymous.4open.science server, it is faster and
|
||||
offer more features.</small
|
||||
>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -402,9 +420,9 @@
|
||||
ng-model="options.expirationMode"
|
||||
>
|
||||
<option value="never" selected>Never expire</option>
|
||||
<option value="redirect"
|
||||
>Redirect to GitHub when expired</option
|
||||
>
|
||||
<option value="redirect">
|
||||
Redirect to GitHub when expired
|
||||
</option>
|
||||
<option value="remove">Remove when expired</option>
|
||||
</select>
|
||||
<small class="form-text text-muted"
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
<div class="container page">
|
||||
<div>
|
||||
<h1>
|
||||
<a ng-href="{{conference.url}}">{{conference.name}}</a>
|
||||
<span
|
||||
class="badge"
|
||||
ng-class="{'badge-warning': conference.status == 'removed' || conference.status == 'expired', 'badge-success': conference.status == 'ready'}"
|
||||
ng-bind="conference.status | title"
|
||||
></span>
|
||||
</h1>
|
||||
<div class="row mb-3 m-0 py-2 border">
|
||||
<div class="col-2 font-weight-bold">ID</div>
|
||||
<div class="col-10">{{conference.conferenceID}}</div>
|
||||
|
||||
<div class="col-2 font-weight-bold">Name</div>
|
||||
<div class="col-10">{{conference.name}}</div>
|
||||
|
||||
<div class="col-2 font-weight-bold">URL</div>
|
||||
<div class="col-10">
|
||||
<a ng-href="{{conference.url}}" ng-bind="conference.url"></a>
|
||||
</div>
|
||||
|
||||
<div class="col-2 font-weight-bold">From</div>
|
||||
<div class="col-10">{{conference.startDate | date}}</div>
|
||||
|
||||
<div class="col-2 font-weight-bold">End</div>
|
||||
<div class="col-10">{{conference.endDate | date}}</div>
|
||||
|
||||
<div class="col-2 font-weight-bold"># Repositories</div>
|
||||
<div class="col-10">{{::conference.repositories.length | number}}</div>
|
||||
|
||||
<div class="col-2 font-weight-bold">Price</div>
|
||||
<div class="col-10">{{conference.price || 0 | number}} €</div>
|
||||
</div>
|
||||
|
||||
<h3>Repositories</h3>
|
||||
<div class="border-bottom color-border-secondary py-3 w-100">
|
||||
<div class="d-flex flex-items-start w-100">
|
||||
<form class="w-100" aria-label="Repositories" accept-charset="UTF-8">
|
||||
<div class="d-flex flex-column flex-lg-row flex-auto">
|
||||
<div class="mb-1 mb-md-0 mr-md-3">
|
||||
<input
|
||||
type="search"
|
||||
id="search"
|
||||
class="form-control"
|
||||
aria-label="Find repositories"
|
||||
placeholder="Find repositories"
|
||||
autocomplete="off"
|
||||
ng-model="search"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap">
|
||||
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||
<button
|
||||
class="btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
id="dropdownSort"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Sort
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownSort">
|
||||
<h6 class="dropdown-header">Select order</h6>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="anonymizeDate"
|
||||
value="-anonymizeDate"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="anonymizeDate">
|
||||
Anonymize Date
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="sortID"
|
||||
value="repoId"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="sortID"> ID </label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="sortStatus"
|
||||
value="-status"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="sortStatus">
|
||||
Status
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||
<button
|
||||
class="btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
id="dropdownStatus"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Status
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownStatus">
|
||||
<h6 class="dropdown-header">Select status</h6>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusReady"
|
||||
value="ready"
|
||||
ng-model="filters.status.ready"
|
||||
/>
|
||||
<label class="form-check-label" for="statusReady">
|
||||
Ready
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusExpired"
|
||||
value="expired"
|
||||
ng-model="filters.status.expired"
|
||||
/>
|
||||
<label class="form-check-label" for="statusExpired">
|
||||
Expired
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusRemoved"
|
||||
value="removed"
|
||||
ng-model="filters.status.removed"
|
||||
/>
|
||||
<label class="form-check-label" for="statusRemoved">
|
||||
Removed
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div
|
||||
class="d-none d-md-flex flex-md-items-center flex-md-justify-end"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="p-0 m-0 w-100">
|
||||
<li
|
||||
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||
ng-class="{'expired': repo.status == 'expired','removed': repo.status == 'removed' }"
|
||||
ng-repeat="repo in conference.repositories| filter:repoFiler| orderBy:orderBy as filteredRepositories"
|
||||
>
|
||||
<div class="w-100">
|
||||
<div class="">
|
||||
<h3>
|
||||
<a ng-href="/r/{{repo.repoId}}" ng-bind="repo.repoId"></a>
|
||||
<span
|
||||
class="badge"
|
||||
ng-class="{'badge-warning': repo.status == 'removed' || repo.status == 'expired', 'badge-success': repo.status == 'ready', 'badge-danger': ''}"
|
||||
ng-bind="repo.status | title"
|
||||
></span>
|
||||
</h3>
|
||||
<span class="color-text-secondary mb-1">
|
||||
<span class="repository">
|
||||
<i class="fab fa-github" aria-hidden="true"></i>
|
||||
<a
|
||||
href="https://github.com/{{repo.source.fullName}}/"
|
||||
class="fullName"
|
||||
ng-bind="repo.source.fullName"
|
||||
></a>
|
||||
</span>
|
||||
<span class="branch" ng-if="repo.options.update">
|
||||
<i class="fas fa-code-branch" aria-hidden="true"></i>
|
||||
<a
|
||||
href="https://github.com/{{repo.source.fullName}}/tree/{{repo.source.branch}}"
|
||||
class="branch"
|
||||
ng-bind="repo.source.branch"
|
||||
></a>
|
||||
</span>
|
||||
<span class="commit" ng-if="!repo.options.update">
|
||||
@<a
|
||||
href="https://github.com/{{repo.source.fullName}}/tree/{{repo.source.commit}}"
|
||||
class="commit"
|
||||
ng-bind="repo.source.commit.substring(0, 8)"
|
||||
></a>
|
||||
</span>
|
||||
anonymized {{repo.anonymizeDate | humanTime}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="color-text-secondary mt-2">
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
class="terms"
|
||||
title="Terms: {{::repo.options.terms.join(', ')}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="fas fa-shield-alt"></i>
|
||||
{{::repo.options.terms.length | number}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="Size: {{::repo.size | humanFileSize}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="fas fa-database"></i> {{::repo.size |
|
||||
humanFileSize}}</span
|
||||
>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="View: {{::repo.pageView | number}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="far fa-eye" aria-hidden="true"></i>
|
||||
{{::repo.pageView | number}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="Last view: {{::repo.lastView | date}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
Last view: {{::repo.lastView | humanTime}}</span
|
||||
>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
ng-if="repo.options.expirationMode!='never' && repo.status == 'ready'"
|
||||
>
|
||||
<i class="far fa-clock" aria-hidden="true"></i>
|
||||
Expire: {{repo.options.expirationDate | humanTime}}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li
|
||||
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||
ng-if="conference.repositories.length == 0"
|
||||
>
|
||||
There is no repository for this conference.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,225 @@
|
||||
<div class="container page">
|
||||
<div class="row">
|
||||
<h1>Conferences</h1>
|
||||
<div class="border-bottom color-border-secondary py-3 w-100">
|
||||
<div class="d-flex flex-items-start w-100">
|
||||
<form class="w-100" aria-label="Repositories" accept-charset="UTF-8">
|
||||
<div class="d-flex flex-column flex-lg-row flex-auto">
|
||||
<div class="mb-1 mb-md-0 mr-md-3">
|
||||
<input
|
||||
type="search"
|
||||
id="search"
|
||||
class="form-control"
|
||||
aria-label="Find a conference…"
|
||||
placeholder="Find a conference…"
|
||||
autocomplete="off"
|
||||
ng-model="search"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap">
|
||||
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||
<button
|
||||
class="btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
id="dropdownSort"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Sort
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownSort">
|
||||
<h6 class="dropdown-header">Select order</h6>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="sortName"
|
||||
value="name"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="sortName">
|
||||
Name
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="sortID"
|
||||
value="conferenceID"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="sortID"> ID </label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="sort"
|
||||
id="sortStatus"
|
||||
value="-status"
|
||||
ng-model="orderBy"
|
||||
/>
|
||||
<label class="form-check-label" for="sortStatus">
|
||||
Status
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||
<button
|
||||
class="btn btn-secondary dropdown-toggle"
|
||||
type="button"
|
||||
id="dropdownStatus"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Status
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownStatus">
|
||||
<h6 class="dropdown-header">Select status</h6>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusReady"
|
||||
value="ready"
|
||||
ng-model="filters.status.ready"
|
||||
/>
|
||||
<label class="form-check-label" for="statusReady">
|
||||
Ready
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusExpired"
|
||||
value="expired"
|
||||
ng-model="filters.status.expired"
|
||||
/>
|
||||
<label class="form-check-label" for="statusExpired">
|
||||
Expired
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check dropdown-item">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="sort"
|
||||
id="statusRemoved"
|
||||
value="removed"
|
||||
ng-model="filters.status.removed"
|
||||
/>
|
||||
<label class="form-check-label" for="statusRemoved">
|
||||
Removed
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="d-none d-md-flex flex-md-items-center flex-md-justify-end">
|
||||
<a href="/conference/new" class="text-center btn btn-primary ml-3">
|
||||
<i class="fa fa-plus-circle" aria-hidden="true"></i> Add
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="p-0 m-0 w-100">
|
||||
<li
|
||||
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||
ng-class="{'expired': conference.status == 'expired','removed': conference.status == 'removed' }"
|
||||
ng-repeat="conference in conferences| filter:conferenceFilter| orderBy:orderBy as filteredConferences"
|
||||
>
|
||||
<div class="w-100">
|
||||
<div class="">
|
||||
<h3>
|
||||
<a
|
||||
ng-href="/conference/{{conference.conferenceID}}"
|
||||
ng-bind="conference.name"
|
||||
></a>
|
||||
<span
|
||||
class="badge"
|
||||
ng-class="{'badge-warning': conference.status == 'removed' || conference.status == 'expired', 'badge-success': conference.status == 'ready', 'badge-danger': ''}"
|
||||
ng-bind="conference.status | title"
|
||||
></span>
|
||||
</h3>
|
||||
<span class="color-text-secondary mb-1 ng-binding">
|
||||
Conference ID: '{{conference.conferenceID}}'
|
||||
</span>
|
||||
</div>
|
||||
<div class="color-text-secondary mt-2">
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="# repository: {{conference.nbRepository || 0 | number}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="fas fa-table"></i>
|
||||
{{::conference.nbRepositories || 0 | number}}</span
|
||||
>
|
||||
<span class="ml-0 mr-3">
|
||||
<i class="fas fa-euro-sign"></i>
|
||||
Total: {{conference.price || 0 | number}} €
|
||||
</span>
|
||||
<span class="ml-0 mr-3">
|
||||
<i class="fas fa-calendar-alt"></i>
|
||||
From {{conference.startDate | date}} to {{conference.endDate |
|
||||
date}}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="dropdown">
|
||||
<button
|
||||
class="btn black_border dropdown-toggle btn-sm"
|
||||
type="button"
|
||||
id="dropdownMenuButton"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Actions
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/conference/{{conference.conferenceID}}/edit"
|
||||
>
|
||||
<i class="far fa-edit" aria-hidden="true"></i> Edit
|
||||
</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="#"
|
||||
ng-show="conference.status != 'removed'"
|
||||
ng-click="removeConference(conference)"
|
||||
>
|
||||
<i class="fas fa-trash-alt"></i> Remove
|
||||
</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="/conference/{{conference.conferenceID}}/"
|
||||
>
|
||||
<i class="fa fa-eye" aria-hidden="true"></i> View conference
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary" ng-if="conferences.length == 0">
|
||||
You have no conference. You a create a
|
||||
<a href="/conference/new">new one</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,42 +215,46 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="color-text-secondary mt-2">
|
||||
<span class="ml-0 mr-3" ng-if="::repo.conference">
|
||||
<i class="fas fa-chalkboard-teacher"></i>
|
||||
{{repo.conference}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
class="terms"
|
||||
title="Terms: {{repo.options.terms.join(', ')}}"
|
||||
title="Terms: {{::repo.options.terms.join(', ')}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="fas fa-shield-alt"></i>
|
||||
{{repo.options.terms.length | number}}
|
||||
{{::repo.options.terms.length | number}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="Size: {{repo.size | humanFileSize}}"
|
||||
title="Size: {{::repo.size | humanFileSize}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="fas fa-database"></i> {{repo.size |
|
||||
<i class="fas fa-database"></i> {{::repo.size |
|
||||
humanFileSize}}</span
|
||||
>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="View: {{repo.pageView | number}}"
|
||||
title="View: {{::repo.pageView | number}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="far fa-eye" aria-hidden="true"></i>
|
||||
{{repo.pageView | number}}
|
||||
{{::repo.pageView | number}}
|
||||
</span>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
title="Last view: {{repo.lastView | date}}"
|
||||
title="Last view: {{::repo.lastView | date}}"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
>
|
||||
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||
Last view: {{repo.lastView | humanTime}}</span
|
||||
Last view: {{::repo.lastView | humanTime}}</span
|
||||
>
|
||||
<span
|
||||
class="ml-0 mr-3"
|
||||
|
||||
@@ -39,6 +39,14 @@
|
||||
>Anonymize</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item" ng-if="user">
|
||||
<a
|
||||
class="nav-link"
|
||||
ng-class="{'active':path == '/conferences'}"
|
||||
href="/conferences"
|
||||
>Conferences</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
<div class="container py-4">
|
||||
<h2>Create a conference</h2>
|
||||
<p>
|
||||
A conference allow the the chairs to access the complete list of anonymized
|
||||
repositories. It also allows to increase the quota for authors.
|
||||
</p>
|
||||
<form class="form needs-validation" name="conference" novalidate>
|
||||
<!-- name -->
|
||||
<div class="form-group">
|
||||
<label for="name">The name of the conference</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="name"
|
||||
id="name"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.name.$invalid}"
|
||||
ng-model="options.name"
|
||||
placeholder="The name of the conference"
|
||||
/>
|
||||
<div class="invalid-feedback" ng-show="conference.name.$error.invalid">
|
||||
The name of the conference is invalid.
|
||||
</div>
|
||||
<div class="invalid-feedback" ng-show="conference.name.$error.required">
|
||||
The name of the conference is required.
|
||||
</div>
|
||||
</div>
|
||||
<!-- url -->
|
||||
<div class="form-group">
|
||||
<label for="url">The url of the conference</label>
|
||||
<input
|
||||
type="url"
|
||||
class="form-control"
|
||||
name="url"
|
||||
id="url"
|
||||
ng-class="{'is-invalid': conference.url.$invalid}"
|
||||
ng-model="options.url"
|
||||
placeholder="The url of the conference"
|
||||
/>
|
||||
<div class="invalid-feedback" ng-show="conference.url.$error.invalid">
|
||||
The url of the conference is invalid.
|
||||
</div>
|
||||
</div>
|
||||
<!-- conferenceID -->
|
||||
<div class="form-group">
|
||||
<label for="conferenceID">The conference ID</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="conferenceID"
|
||||
id="conferenceID"
|
||||
required
|
||||
pattern="[a-zA-Z0-9\-_]{3,10}"
|
||||
ng-class="{'is-invalid': conference.conferenceID.$invalid}"
|
||||
ng-model="options.conferenceID"
|
||||
placeholder="The conference ID that the authors will reference"
|
||||
/>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.conferenceID.$error.used"
|
||||
>
|
||||
The conference ID '{{options.conferenceID}}' is already used.
|
||||
</div>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.conferenceID.$error.required"
|
||||
>
|
||||
The conference ID is required.
|
||||
</div>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.conferenceID.$error.pattern"
|
||||
>
|
||||
The format of the conference ID is incorrect ([a-zA-Z0-9-_]{3,10}).
|
||||
</div>
|
||||
</div>
|
||||
<!-- startDate -->
|
||||
<div class="form-group">
|
||||
<label for="startDate">Start date of the conference</label>
|
||||
<input
|
||||
type="date"
|
||||
class="form-control"
|
||||
name="startDate"
|
||||
id="startDate"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.startDate.$invalid}"
|
||||
ng-model="options.startDate"
|
||||
/>
|
||||
<small class="form-text text-muted"
|
||||
>The beginning date of the reviewing process.</small
|
||||
>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.startDate.$error.required"
|
||||
>
|
||||
The start date of the conference is required.
|
||||
</div>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.startDate.$error.invalid"
|
||||
>
|
||||
The start date of the conference is invalid. The start date should
|
||||
always be smaller than the end date.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- endDate -->
|
||||
<div class="form-group">
|
||||
<label for="endDate">End date of the conference</label>
|
||||
<input
|
||||
type="date"
|
||||
class="form-control"
|
||||
name="endDate"
|
||||
id="endDate"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.endDate.$invalid}"
|
||||
ng-model="options.endDate"
|
||||
/>
|
||||
<small class="form-text text-muted"
|
||||
>The end date of the reviewing process. All the repositories will expire
|
||||
and they will not be accessible after this date.</small
|
||||
>
|
||||
<div
|
||||
class="invalid-feedback"
|
||||
ng-show="conference.endDate.$error.required"
|
||||
>
|
||||
The end date of the conference is required.
|
||||
</div>
|
||||
<div class="invalid-feedback" ng-show="conference.endDate.$error.invalid">
|
||||
The end date of the conference is invalid. The end date should always be
|
||||
smaller than today.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Anonymization options</h4>
|
||||
|
||||
<div class="accordion mb-3" id="options">
|
||||
<div class="card">
|
||||
<div class="card-header" id="headingOne">
|
||||
<h2 class="mb-0">
|
||||
<button
|
||||
class="btn btn-block text-left"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#collapseOne"
|
||||
aria-expanded="true"
|
||||
aria-controls="collapseOne"
|
||||
>
|
||||
Rendering options
|
||||
</button>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="collapseOne"
|
||||
class="collapse show"
|
||||
aria-labelledby="headingOne"
|
||||
data-parent="#options"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="link"
|
||||
name="link"
|
||||
ng-model="options.options.link"
|
||||
/>
|
||||
<label class="form-check-label" for="link">Keep links</label>
|
||||
<small id="linkHelp" class="form-text text-muted"
|
||||
>Keep or remove all links from text files.</small
|
||||
>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="image"
|
||||
name="image"
|
||||
ng-model="options.options.image"
|
||||
/>
|
||||
<label class="form-check-label" for="image"
|
||||
>Display images</label
|
||||
>
|
||||
<small id="imageHelp" class="form-text text-muted"
|
||||
>Display or hide images from the repositories and text
|
||||
files.</small
|
||||
>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="pdf"
|
||||
name="pdf"
|
||||
ng-model="options.options.pdf"
|
||||
/>
|
||||
<label class="form-check-label" for="pdf">Display PDFs</label>
|
||||
<small id="pdfHelp" class="form-text text-muted"
|
||||
>Display or hide PDF from the repositories.</small
|
||||
>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="notebook"
|
||||
name="notebook"
|
||||
ng-model="options.options.notebook"
|
||||
/>
|
||||
<label class="form-check-label" for="notebook"
|
||||
>Display Notebooks</label
|
||||
>
|
||||
<small id="notebookHelp" class="form-text text-muted"
|
||||
>Display or hide Notebooks from the repositories.</small
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header" id="headingTwo">
|
||||
<h2 class="mb-0">
|
||||
<button
|
||||
class="btn btn-block text-left collapsed"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#collapseTwo"
|
||||
aria-expanded="false"
|
||||
aria-controls="collapseTwo"
|
||||
>
|
||||
Features
|
||||
</button>
|
||||
</h2>
|
||||
</div>
|
||||
<div
|
||||
id="collapseTwo"
|
||||
class="collapse"
|
||||
aria-labelledby="headingTwo"
|
||||
data-parent="#options"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="update"
|
||||
name="update"
|
||||
ng-model="options.options.update"
|
||||
/>
|
||||
<label class="form-check-label" for="update">Auto update</label>
|
||||
<small id="termsHelp" class="form-text text-muted"
|
||||
>Automatically update the anonymized repository with the
|
||||
latest commit of the repository. The repository is updated
|
||||
once per hour maximum.</small
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="page"
|
||||
name="page"
|
||||
ng-model="options.options.page"
|
||||
/>
|
||||
<label class="form-check-label" for="page">Github page</label>
|
||||
<small id="termsHelp" class="form-text text-muted"
|
||||
>Enable anonymized Github pages.</small
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Plan</h4>
|
||||
<small class="text-muted">The repositories are bill per hour.</small>
|
||||
<div class="card-deck mb-3 text-center">
|
||||
<div class="card mb-4 shadow-sm" ng-repeat="plan in plans">
|
||||
<div class="card-header">
|
||||
<h4 class="my-0 font-weight-normal" ng-bind="plan.name"></h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h1 class="card-title pricing-card-title">
|
||||
{{plan.pricePerRepo | currency}}
|
||||
<small class="text-muted"> / repository / month</small>
|
||||
</h1>
|
||||
<ul
|
||||
class="list-unstyled mt-3 mb-4"
|
||||
ng-bind-html="plan.description"
|
||||
></ul>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-lg btn-block"
|
||||
ng-class="{'btn-primary': options.plan.planID == plan.id}"
|
||||
ng-click="options.plan.planID = plan.id"
|
||||
>
|
||||
Select
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="plan.pricePerRepo > 0">
|
||||
<h3>Billing</h3>
|
||||
|
||||
<!-- name -->
|
||||
<div class="form-group">
|
||||
<label for="billing_name">The name & last name</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="billing_name"
|
||||
id="billing_name"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.billing_name.$invalid}"
|
||||
ng-model="options.billing.name"
|
||||
placeholder="Name & last name"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- email -->
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
name="email"
|
||||
id="email"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.email.$invalid}"
|
||||
ng-model="options.billing.email"
|
||||
placeholder="Email"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- address -->
|
||||
<div class="form-group">
|
||||
<label for="inputAddress">Address</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="inputAddress"
|
||||
id="inputAddress"
|
||||
required
|
||||
placeholder="1234 Main St"
|
||||
ng-model="options.billing.address"
|
||||
ng-class="{'is-invalid': conference.inputAddress.$invalid}"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="inputAddress2"
|
||||
id="inputAddress2"
|
||||
ng-model="options.billing.address2"
|
||||
ng-class="{'is-invalid': conference.inputAddress2.$invalid}"
|
||||
placeholder="Apartment, studio, or floor"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="city"
|
||||
id="city"
|
||||
ng-model="options.billing.city"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.city.$invalid}"
|
||||
placeholder="City"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="country"
|
||||
id="country"
|
||||
ng-model="options.billing.country"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.country.$invalid}"
|
||||
placeholder="Country"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="zip"
|
||||
id="zip"
|
||||
ng-model="options.billing.zip"
|
||||
required
|
||||
ng-class="{'is-invalid': conference.zip.$invalid}"
|
||||
placeholder="Zip"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VAT -->
|
||||
<div class="form-group">
|
||||
<label for="vat">VAT Number</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="vat"
|
||||
id="vat"
|
||||
ng-class="{'is-invalid': conference.vat.$invalid}"
|
||||
ng-model="options.billing.vat"
|
||||
placeholder="VAT Number"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="alert alert-danger"
|
||||
role="alert"
|
||||
ng-if="error"
|
||||
ng-bind="error"
|
||||
></div>
|
||||
<div
|
||||
class="alert alert-success"
|
||||
role="alert"
|
||||
ng-if="message"
|
||||
ng-bind="message"
|
||||
></div>
|
||||
|
||||
<button
|
||||
id="send"
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
ng-click="submit($event)"
|
||||
>
|
||||
{{editionMode ? "Update" : "Create"}}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
+316
-1
@@ -43,6 +43,26 @@ angular
|
||||
controller: "statusController",
|
||||
title: "Repository status - Anonymous GitHub",
|
||||
})
|
||||
.when("/conferences", {
|
||||
templateUrl: "/partials/conferences.htm",
|
||||
controller: "conferencesController",
|
||||
title: "Conferences - Anonymous GitHub",
|
||||
})
|
||||
.when("/conference/new", {
|
||||
templateUrl: "/partials/newConference.htm",
|
||||
controller: "newConferenceController",
|
||||
title: "Add a conference - Anonymous GitHub",
|
||||
})
|
||||
.when("/conference/:conferenceId/edit", {
|
||||
templateUrl: "/partials/newConference.htm",
|
||||
controller: "newConferenceController",
|
||||
title: "Edit conference - Anonymous GitHub",
|
||||
})
|
||||
.when("/conference/:conferenceId", {
|
||||
templateUrl: "/partials/conference.htm",
|
||||
controller: "conferenceController",
|
||||
title: "Conference - Anonymous GitHub",
|
||||
})
|
||||
.when("/faq", {
|
||||
templateUrl: "/partials/faq.htm",
|
||||
controller: "faqController",
|
||||
@@ -619,7 +639,7 @@ angular
|
||||
body: `The repository ${repo.repoId} is going to be removed.`,
|
||||
};
|
||||
$scope.toasts.push(toast);
|
||||
|
||||
|
||||
$http.post(`/api/repo/${repo.repoId}/refresh`).then(() => {
|
||||
toast.title = `${repo.repoId} is refreshed.`;
|
||||
toast.body = `The repository ${repo.repoId} is refreshed.`;
|
||||
@@ -878,6 +898,35 @@ angular
|
||||
$scope.readme = res.data;
|
||||
}
|
||||
|
||||
function getConference() {
|
||||
if (!$scope.conference) return;
|
||||
$http.get("/api/conferences/" + $scope.conference).then(
|
||||
(res) => {
|
||||
$scope.conference_data = res.data;
|
||||
$scope.conference_data.startDate = new Date(
|
||||
$scope.conference_data.startDate
|
||||
);
|
||||
$scope.conference_data.endDate = new Date(
|
||||
$scope.conference_data.endDate
|
||||
);
|
||||
|
||||
$scope.options.expirationDate = new Date(
|
||||
$scope.conference_data.endDate
|
||||
);
|
||||
$scope.options.expirationMode = "remove";
|
||||
|
||||
$scope.options.update = $scope.conference_data.options.update;
|
||||
$scope.options.image = $scope.conference_data.options.image;
|
||||
$scope.options.pdf = $scope.conference_data.options.pdf;
|
||||
$scope.options.notebook = $scope.conference_data.options.notebook;
|
||||
$scope.options.link = $scope.conference_data.options.link;
|
||||
},
|
||||
(err) => {
|
||||
$scope.conference_data = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function anonymize() {
|
||||
const urlRegex =
|
||||
/<?\b((https?|ftp|file):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]\b\/?>?/g;
|
||||
@@ -950,6 +999,7 @@ angular
|
||||
$scope.anonymize.repoUrl.$setValidity("used", true);
|
||||
$scope.anonymize.repoUrl.$setValidity("missing", true);
|
||||
$scope.anonymize.repoUrl.$setValidity("access", true);
|
||||
$scope.anonymize.conference.$setValidity("activated", true);
|
||||
$scope.anonymize.terms.$setValidity("format", true);
|
||||
$scope.anonymize.terms.$setValidity("format", true);
|
||||
}
|
||||
@@ -980,6 +1030,9 @@ angular
|
||||
case "repo_not_accessible":
|
||||
$scope.anonymize.repoUrl.$setValidity("access", false);
|
||||
break;
|
||||
case "conf_not_activated":
|
||||
$scope.anonymize.conference.$setValidity("activated", false);
|
||||
break;
|
||||
default:
|
||||
$scope.anonymize.$setValidity("error", false);
|
||||
break;
|
||||
@@ -1039,6 +1092,9 @@ angular
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$watch("conference", async (v) => {
|
||||
getConference();
|
||||
});
|
||||
$scope.$watch("source.branch", async (v) => {
|
||||
const selected = $scope.branches.filter(
|
||||
(f) => f.name == $scope.source.branch
|
||||
@@ -1318,4 +1374,263 @@ angular
|
||||
|
||||
init();
|
||||
},
|
||||
])
|
||||
.controller("conferencesController", [
|
||||
"$scope",
|
||||
"$http",
|
||||
"$location",
|
||||
function ($scope, $http, $location) {
|
||||
$scope.$watch("user.status", () => {
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
});
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
|
||||
$scope.conferences = [];
|
||||
$scope.search = "";
|
||||
$scope.filters = {
|
||||
status: { ready: true, expired: false, removed: false },
|
||||
};
|
||||
$scope.orderBy = "name";
|
||||
|
||||
$scope.removeConference = function (conf) {
|
||||
if (
|
||||
confirm(
|
||||
`Are you sure that you want to remove the conference ${conf.name}? All the repositories linked to this conference will expire.`
|
||||
)
|
||||
) {
|
||||
const toast = {
|
||||
title: `Removing ${conf.name}...`,
|
||||
date: new Date(),
|
||||
body: `The conference ${conf.name} is going to be removed.`,
|
||||
};
|
||||
$scope.toasts.push(toast);
|
||||
$http.delete(`/api/conferences/${conf.conferenceID}`).then(() => {
|
||||
toast.title = `${conf.name} is removed.`;
|
||||
toast.body = `The conference ${conf.name} is removed.`;
|
||||
getConferences();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function getConferences() {
|
||||
$http.get("/api/conferences/").then(
|
||||
(res) => {
|
||||
$scope.conferences = res.data || [];
|
||||
},
|
||||
(err) => {
|
||||
console.error(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
getConferences();
|
||||
|
||||
$scope.conferenceFilter = (conference) => {
|
||||
if ($scope.filters.status[conference.status] == false) return false;
|
||||
|
||||
if ($scope.search.trim().length == 0) return true;
|
||||
|
||||
if (conference.name.indexOf($scope.search) > -1) return true;
|
||||
if (conference.conferenceID.indexOf($scope.search) > -1) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
},
|
||||
])
|
||||
.controller("newConferenceController", [
|
||||
"$scope",
|
||||
"$http",
|
||||
"$location",
|
||||
"$routeParams",
|
||||
function ($scope, $http, $location, $routeParams) {
|
||||
$scope.$watch("user.status", () => {
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
});
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
|
||||
$scope.plans = [];
|
||||
$scope.editionMode = false;
|
||||
|
||||
function getConference() {
|
||||
$http
|
||||
.get("/api/conferences/" + $routeParams.conferenceId)
|
||||
.then((res) => {
|
||||
$scope.options = res.data;
|
||||
});
|
||||
}
|
||||
if ($routeParams.conferenceId) {
|
||||
$scope.editionMode = true;
|
||||
getConference();
|
||||
}
|
||||
|
||||
function getPlans() {
|
||||
$http.get("/api/conferences/plans").then((res) => {
|
||||
$scope.plans = res.data;
|
||||
|
||||
$scope.plan = $scope.plans.filter(
|
||||
(f) => f.id == $scope.options.plan.planID
|
||||
)[0];
|
||||
});
|
||||
}
|
||||
getPlans();
|
||||
const start = new Date();
|
||||
start.setDate(1);
|
||||
console.log(start);
|
||||
start.setMonth(start.getMonth() + 1);
|
||||
const end = new Date();
|
||||
end.setMonth(start.getMonth() + 7, 0);
|
||||
$scope.options = {
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
plan: {
|
||||
planID: "free_conference",
|
||||
},
|
||||
options: {
|
||||
link: true,
|
||||
image: true,
|
||||
pdf: true,
|
||||
notebook: true,
|
||||
update: true,
|
||||
page: true,
|
||||
},
|
||||
};
|
||||
$scope.plan = null;
|
||||
|
||||
$scope.$watch("options.plan.planID", () => {
|
||||
console.log($scope.plans, $scope.options);
|
||||
$scope.plan = $scope.plans.filter(
|
||||
(f) => f.id == $scope.options.plan.planID
|
||||
)[0];
|
||||
});
|
||||
|
||||
function resetValidity() {
|
||||
$scope.conference.name.$setValidity("required", true);
|
||||
$scope.conference.conferenceID.$setValidity("pattern", true);
|
||||
$scope.conference.conferenceID.$setValidity("required", true);
|
||||
$scope.conference.conferenceID.$setValidity("used", true);
|
||||
$scope.conference.startDate.$setValidity("required", true);
|
||||
$scope.conference.startDate.$setValidity("invalid", true);
|
||||
$scope.conference.endDate.$setValidity("required", true);
|
||||
$scope.conference.endDate.$setValidity("invalid", true);
|
||||
$scope.conference.$setValidity("error", true);
|
||||
}
|
||||
|
||||
function displayErrorMessage(message) {
|
||||
switch (message) {
|
||||
case "conf_name_missing":
|
||||
$scope.conference.name.$setValidity("required", false);
|
||||
break;
|
||||
case "conf_id_missing":
|
||||
$scope.conference.conferenceID.$setValidity("required", false);
|
||||
break;
|
||||
case "conf_id_format":
|
||||
$scope.conference.conferenceID.$setValidity("pattern", false);
|
||||
break;
|
||||
case "conf_id_used":
|
||||
$scope.conference.conferenceID.$setValidity("used", false);
|
||||
break;
|
||||
case "conf_start_date_missing":
|
||||
$scope.conference.startDate.$setValidity("required", false);
|
||||
break;
|
||||
case "conf_end_date_missing":
|
||||
$scope.conference.endDate.$setValidity("required", false);
|
||||
break;
|
||||
case "conf_start_date_invalid":
|
||||
$scope.conference.startDate.$setValidity("invalid", false);
|
||||
break;
|
||||
case "conf_end_date_invalid":
|
||||
$scope.conference.endDate.$setValidity("invalid", false);
|
||||
break;
|
||||
default:
|
||||
$scope.conference.$setValidity("error", false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submit = function () {
|
||||
const toast = {
|
||||
title: `Creating ${$scope.options.name}...`,
|
||||
date: new Date(),
|
||||
body: `The conference ${$scope.options.conferenceID} is in creation.`,
|
||||
};
|
||||
if ($scope.editionMode) {
|
||||
toast.title = `Updating ${$scope.options.name}...`;
|
||||
toast.body = `The conference '${$scope.options.conferenceID}' is updating.`;
|
||||
}
|
||||
$scope.toasts.push(toast);
|
||||
resetValidity();
|
||||
$http
|
||||
.post(
|
||||
"/api/conferences/" +
|
||||
($scope.editionMode ? $scope.options.conferenceID : ""),
|
||||
$scope.options
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
if (!$scope.editionMode) {
|
||||
toast.title = `${$scope.options.name} created`;
|
||||
toast.body = `The conference '${$scope.options.conferenceID}' is created.`;
|
||||
} else {
|
||||
toast.title = `${$scope.options.name} updated`;
|
||||
toast.body = `The conference '${$scope.options.conferenceID}' is updated.`;
|
||||
}
|
||||
$location.url("/conference/" + $scope.options.conferenceID);
|
||||
},
|
||||
(error) => {
|
||||
displayErrorMessage(error.data.error);
|
||||
$scope.removeToast(toast);
|
||||
}
|
||||
);
|
||||
};
|
||||
},
|
||||
])
|
||||
.controller("conferenceController", [
|
||||
"$scope",
|
||||
"$http",
|
||||
"$location",
|
||||
"$routeParams",
|
||||
function ($scope, $http, $location, $routeParams) {
|
||||
$scope.$watch("user.status", () => {
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
});
|
||||
if ($scope.user == null) {
|
||||
$location.url("/");
|
||||
}
|
||||
$scope.conference = null;
|
||||
|
||||
$scope.search = "";
|
||||
$scope.filters = {
|
||||
status: { ready: true, expired: false, removed: false },
|
||||
};
|
||||
$scope.orderBy = "-anonymizeDate";
|
||||
|
||||
$scope.repoFiler = (repo) => {
|
||||
if ($scope.filters.status[repo.status] == false) return false;
|
||||
|
||||
if ($scope.search.trim().length == 0) return true;
|
||||
|
||||
if (repo.source.fullName.indexOf($scope.search) > -1) return true;
|
||||
if (repo.repoId.indexOf($scope.search) > -1) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function getConference() {
|
||||
$http
|
||||
.get("/api/conferences/" + $routeParams.conferenceId)
|
||||
.then((res) => {
|
||||
$scope.conference = res.data;
|
||||
});
|
||||
}
|
||||
getConference();
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user