forked from matecat/microsoft_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Segments Filter: in revise default enabled
- Loading branch information
Showing
7 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
module.exports = function(grunt) { | ||
|
||
var es2015Preset = require('babel-preset-es2015'); | ||
var reactPreset = require('babel-preset-react'); | ||
|
||
grunt.initConfig( { | ||
browserify: { | ||
core: { | ||
options: { | ||
transform: [ | ||
[ 'babelify', { presets: [ es2015Preset, reactPreset ] } ] | ||
], | ||
browserifyOptions: { | ||
paths: [ __dirname + '/node_modules' ] | ||
} | ||
}, | ||
src: [ | ||
'static/src/js/cat_source/microsoft-core.js', | ||
'static/src/js/cat_source/microsoft-core.*.js' | ||
], | ||
dest: 'static/build/microsoft-core-build.js' | ||
}, | ||
}, | ||
sass: { | ||
dist: { | ||
options: { | ||
sourceMap: false, | ||
includePaths: ['static/src/css/sass/'] | ||
}, | ||
src: [ | ||
'static/src/css/sass/microsoft-core.scss' | ||
], | ||
dest: 'static/build/microsoft-build.css' | ||
} | ||
}, | ||
replace: { | ||
css: { | ||
src: [ | ||
'static/build/*' | ||
], | ||
dest: 'static/build/', | ||
replacements: [ | ||
{ | ||
from: 'url(../img', | ||
to: 'url(../src/css/img' | ||
} | ||
] | ||
} | ||
} | ||
|
||
}); | ||
|
||
grunt.loadNpmTasks('grunt-browserify'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-sass'); | ||
grunt.loadNpmTasks('grunt-text-replace'); | ||
|
||
// Define your tasks here | ||
grunt.registerTask('default', ['bundle:js']); | ||
|
||
grunt.registerTask('bundle:js', [ | ||
'browserify:core', | ||
'sass', | ||
'replace' | ||
]); | ||
|
||
|
||
|
||
}; |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Features\Microsoft\Decorator; | ||
|
||
|
||
use AbstractDecorator; | ||
use Features\Microsoft\Utils\Routes; | ||
|
||
class CatDecorator extends AbstractDecorator { | ||
/** | ||
* @var \PHPTALWithAppend | ||
*/ | ||
protected $template; | ||
|
||
public function decorate() { | ||
$this->template->append( 'footer_js', Routes::staticBuild( '/microsoft-core-build.js' ) ); | ||
$this->template->append( 'css_resources', Routes::staticBuild( '/microsoft-build.css' ) ); | ||
|
||
$this->template->segment_filter_size = '50' ; | ||
$this->template->segment_filter_type = 'regular_intervals' ; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: fregini | ||
* Date: 3/21/16 | ||
* Time: 12:05 PM | ||
*/ | ||
namespace Features\Microsoft\Utils; | ||
|
||
class Routes { | ||
|
||
|
||
public static function staticSrc( $file, $options=array() ) { | ||
$host = \Routes::pluginsBase( $options ); | ||
return $host . "/microsoft/static/src/$file" ; | ||
} | ||
|
||
public static function staticBuild( $file, $options=array() ) { | ||
$host = \Routes::pluginsBase( $options ); | ||
return $host . "/microsoft/static/build/$file" ; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "matecat-microsoft-plugin", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "Gruntfile.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "MateCat Team", | ||
"license": "LGPL", | ||
"dependencies": { | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-react": "^6.11.1", | ||
"babelify": "^7.2.0", | ||
"grunt": "~0.4.2", | ||
"grunt-browserify": "^4.0.1", | ||
"grunt-contrib-concat": "~0.5.1", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-sass": "^2.0.0", | ||
"grunt-string-replace": "~0.2.7", | ||
"grunt-strip": "^0.2.1", | ||
"grunt-text-replace": "^0.4.0", | ||
"keymirror": "^0.1.1", | ||
"node-sass": "^4.6.1" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
.advanced-filter-searchbox { | ||
.filters-container { | ||
display: none; | ||
} | ||
|
||
.search-settings { | ||
display: none; | ||
} | ||
|
||
.data-sample-checkbox-container { | ||
display: none; | ||
} | ||
|
||
#clear-filter { | ||
display: none; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
|
||
(function(SF) { | ||
|
||
let filte_size = '50'; | ||
let filter_type = 'regular_intervals'; | ||
$.extend(UI, { | ||
|
||
}); | ||
|
||
$.extend(SF, { | ||
|
||
closeFilter: function ( ) { | ||
CatToolActions.closeSubHeader(); | ||
this.open = false; | ||
} | ||
|
||
}); | ||
|
||
function overrideSegmentsFilter( SegmentsFilter ) { | ||
let originalComponentDidMount = SegmentsFilter.prototype.componentDidMount; | ||
let originaldefaultState = SegmentsFilter.prototype.defaultState; | ||
SegmentsFilter.prototype.componentDidMount = function ( ) { | ||
|
||
let storedState = SegmentFilter.getStoredState(); | ||
if (config.isReview && !storedState.reactState) { | ||
originalComponentDidMount.apply(this); | ||
this.doSubmitFilter(); | ||
} else { | ||
originalComponentDidMount.apply(this); | ||
} | ||
}; | ||
|
||
SegmentsFilter.prototype.defaultState = function ( ) { | ||
let storedState = SegmentFilter.getStoredState(); | ||
if (config.isReview && !storedState.reactState) { | ||
return { | ||
searchSettingsOpen: false, | ||
selectedStatus: '', | ||
samplingEnabled: true, | ||
samplingType: filter_type, | ||
samplingSize: filte_size, | ||
filtering: false, | ||
filteredCount: 0, | ||
segmentsArray: [], | ||
moreFilters: this.moreFilters | ||
|
||
} | ||
} else { | ||
return originaldefaultState.apply(this); | ||
} | ||
} | ||
} | ||
overrideSegmentsFilter(SegmentFilter); | ||
|
||
})(SegmentFilter) ; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(function() { | ||
|
||
$.extend(UI, { | ||
|
||
}); | ||
|
||
})() ; |