Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 'reviewed by' and timestamp to interface, updating view when clicked
minor styling adjustments update composer.lock
- Loading branch information
1 parent
3c90f74
commit ed70ca9
Showing
9 changed files
with
1,338 additions
and
170 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
function saveState( id, val ) { | ||
buttonId = null; | ||
unusedButtonId = null; | ||
buttonClass = null; | ||
unusedButtonClass = null; | ||
if ( val == 'fixed' ) { | ||
buttonId = '#success' + id; | ||
unusedButtonId = '#danger' + id; | ||
buttonClass = 'success'; | ||
unusedButtonClass = 'danger'; | ||
} else if ( val == 'false' ) { | ||
buttonId = '#danger' + id; | ||
unusedButtonId = '#success' + id; | ||
unusedButtonClass = 'success'; | ||
buttonClass = 'danger'; | ||
} | ||
$( buttonId ).removeClass( 'btn-' + buttonClass ).addClass( 'btn-' + buttonClass + '-clicked' ).blur(); | ||
$( unusedButtonId ).removeClass( 'btn-' + unusedButtonClass ).addClass( 'btn-secondary' ).prop( 'disabled', 'disabled' ).blur(); | ||
var buttonId, unusedButtonId, buttonClass, unusedButtonClass; | ||
|
||
$.get( 'review/add', | ||
{ id: id, val: val } | ||
).done( function ( ret ) { | ||
console.log( ret ); | ||
if ( ret == 'false' ) { | ||
$( buttonId ).addClass( 'btn-' + buttonClass ).removeClass( 'btn-' + buttonClass + '-clicked' ).blur(); | ||
$( unusedButtonId ).removeClass( 'btn-secondary' ).prop( 'disabled', false ).addClass( 'btn-' + unusedButtonClass ); | ||
alert( 'There was an error in connecting to database.' ); | ||
} else if ( ret == 'Unauthorized' ) { | ||
alert( 'You need to be logged in to be able to review.' ); | ||
$( buttonId ).addClass( 'btn-' + buttonClass ).removeClass( 'btn-' + buttonClass + '-clicked' ).blur(); | ||
$( unusedButtonId ).removeClass( 'btn-secondary' ).prop( 'disabled', false ).addClass( 'btn-' + unusedButtonClass ); | ||
} | ||
} | ||
); | ||
if ( val === 'fixed' ) { | ||
buttonId = '#success' + id; | ||
unusedButtonId = '#danger' + id; | ||
buttonClass = 'success'; | ||
unusedButtonClass = 'danger'; | ||
} else if ( val === 'false' ) { | ||
buttonId = '#danger' + id; | ||
unusedButtonId = '#success' + id; | ||
unusedButtonClass = 'success'; | ||
buttonClass = 'danger'; | ||
} | ||
$( buttonId ).removeClass( 'btn-' + buttonClass ).addClass( 'btn-' + buttonClass + '-clicked' ).blur(); | ||
$( unusedButtonId ).removeClass( 'btn-' + unusedButtonClass ).addClass( 'btn-secondary' ).prop( 'disabled', 'disabled' ).blur(); | ||
|
||
$.ajax({ | ||
url: 'review/add', | ||
data: { | ||
id: id, | ||
val: val | ||
}, | ||
dataType: 'json' | ||
}).done( function ( ret ) { | ||
if ( ret.user ) { | ||
$reviewerNode = $( '.status-div-reviewer-' + id ).show(); | ||
$reviewerNode.find('.reviewer-link').prop( 'href', ret.userpage ).text( ret.user ); | ||
$reviewerNode.find('.reviewer-timestamp').text( ret.timestamp ); | ||
$( unusedButtonId ).removeClass( 'btn-secondary' ).prop( 'disabled', true ).addClass( 'btn-' + unusedButtonClass ); | ||
} else { | ||
if ( ret.error === 'Unauthorized' ) { | ||
alert( 'You need to be logged in to be able to review.' ); | ||
} else { | ||
alert( 'There was an error in connecting to database.' ); | ||
} | ||
$( buttonId ).addClass( 'btn-' + buttonClass ).removeClass( 'btn-' + buttonClass + '-clicked' ).blur(); | ||
$( unusedButtonId ).removeClass( 'btn-secondary' ).prop( 'disabled', false ).addClass( 'btn-' + unusedButtonClass ); | ||
} | ||
} | ||
); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,11 @@ protected function handleGet() { | |
$records[$key]['editor_page_dead'] = false; | ||
$records[$key]['editor_talk_dead'] = false; | ||
} | ||
$records[$key]['reviewed'] = $record['status_user'] ? true : false; | ||
This comment has been minimized.
Sorry, something went wrong.
Niharika29
Collaborator
|
||
if ( $records[$key]['reviewed'] ) { | ||
$records[$key]['reviewed_by_url'] = $this->getUserPage( $record['status_user'] ); | ||
$records[$key]['review_timestamp'] = $this->formatTimestamp( $record['review_timestamp'] ); | ||
} | ||
$records[$key]['wikiprojects'] = $this->wikiprojectDao->getWikiProjects( $record['page_title'] ); | ||
$records[$key]['page_title'] = $this->removeUnderscores( $record['page_title'] ); | ||
$cleanWikiprojects = array(); | ||
|
@@ -156,7 +161,7 @@ public function getReportLink( $ithenticateId ) { | |
*/ | ||
public function formatTimestamp( $datetime ) { | ||
$datetime = strtotime( $datetime ); | ||
return date( 'd-m-y h:m:s', $datetime ); | ||
return date( 'Y-m-d h:m', $datetime ); | ||
} | ||
|
||
|
||
|
Oops, something went wrong.
Nitpick: There's some inconsistent bracketing style here. I would suggest changing the style of the done() section to match that of the ajax() section, i.e. reducing the tabbing and combining the last 2 lines into 1: "});". This is the style used most commonly in MediaWiki JS code.