Skip to content

Commit

Permalink
Adding Languages page
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyfox committed Aug 4, 2017
1 parent 85f3578 commit b131189
Show file tree
Hide file tree
Showing 18 changed files with 1,895 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
MobileDatabase.iml
.idea
node_modules
.DS_Store
/bower_components
Expand Down
22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/runConfigurations/www.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,749 changes: 1,749 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion eanaEltuMigration/dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ Dictionary.prototype.exportLanguages = function (){
isoName: language.engName,
nativeName: language.nativeName,
active: language.active,
export: language.active
export: language.active,
primary: (langId === "nav")
});
}

Expand Down
9 changes: 7 additions & 2 deletions models/dictionaryBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,24 @@ module.exports = function (sequelize, DataTypes) {
],
order: [['position', 'ASC']]
}).then(function (buildData) {
let document = "";
const documentParts = new Array(buildData.length);
for(let i = 0; i < buildData.length; i++){
switch(buildData[i].type){
case "template":
document += buildData[i].DictionaryTemplate[type];
documentParts[i] = buildData[i].DictionaryTemplate[type];
break;

case "mainblock":
//document += buildData[i].DictionaryBlock
break;

case "block":

break;
}
}

let document = documentParts.join('\n');
for(let i = 0; i < localizedMetadata.length; i++){
document = document.replace(new RegExp(`__${localizedMetadata[i].MetadatumId}__`, "g"), localizedMetadata[i].value);
}
Expand Down
3 changes: 2 additions & 1 deletion models/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = function (sequelize, DataTypes) {
isoName: { type: DataTypes.STRING, allowNull: false },
nativeName: { type: DataTypes.STRING, allowNull: false },
active: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
export: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }
export: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
primary: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }
});

Language.associate = function (models) {
Expand Down
1 change: 1 addition & 0 deletions www/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
angular.module('naranawm', [
'ngRoute',
'ngResource',
'naranawm.languages',
'naranawm.view1',
'naranawm.view2',
'naranawm.version',
Expand Down
1 change: 1 addition & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<script src="services/models.js"></script>
<script src="view1/view1.js"></script>
<script src="view2/view2.js"></script>
<script src="languages/languages.js"></script>
<script src="components/version/version.js"></script>
<script src="components/version/version-directive.js"></script>
<script src="components/version/interpolate-filter.js"></script>
Expand Down
27 changes: 27 additions & 0 deletions www/languages/languages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="page-header">
<h1>Languages</h1>
</div>
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th>ISO Code</th>
<th>Name</th>
<th>Native Name</th>
<th>Active</th>
<th>Export</th>
<th>Primary</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in languages">
<td>{{ row.isoCode }}</td>
<td>{{ row.isoName }}</td>
<td>{{ row.nativeName }}</td>
<td>{{ row.active }}</td>
<td>{{ row.export }}</td>
<td>{{ row.primary }}</td>
</tr>
</tbody>
</table>
</div>
16 changes: 16 additions & 0 deletions www/languages/languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

angular.module('naranawm.languages', ['ngRoute'])

.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/languages', {
templateUrl: 'languages/languages.html',
controller: 'LanguagesCtrl'
});
}])

.controller('LanguagesCtrl', ["$scope", "Models", function($scope, Models) {
$scope.languages = Models.query({model: "Language"}, function() {

}); //query() returns all the entries
}]);
2 changes: 1 addition & 1 deletion www/view1/view1.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ angular.module('naranawm.view1', ['ngRoute'])

.controller('View1Ctrl', ["$scope", "Models", function($scope, Models) {
$scope.lemmas = Models.query({model: "Lemma"}, function() {
console.log($scope.lemmas);

}); //query() returns all the entries
}]);

0 comments on commit b131189

Please sign in to comment.