-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Resource Geogebra #131
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
|
||
class Resource extends Model | ||
{ | ||
protected $fillable = ['name','type', 'path', 'link']; | ||
protected $fillable = ['name','type', 'path', 'link', 'geotype']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ponele en lugar de geotype, geogebra_type. Para ponerlo en el modelo tenes que crear una migracion. Que va a modificar la tabla Resource y agergar 2 campos. en esta linea que esta el comentario tenes que agregar tambien geogebra_code |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
return [ | ||
'name' => $faker->word, | ||
'type' => $faker->text, | ||
'link' => $faker->url | ||
'link' => $faker->url, | ||
'geotype' => 'ZT6xkDYM' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cambiar por geogebra_type. Aca ese codigo esta mal, lo que es el tipo es 3d, graphing, geometry. osea podes poner cualquiera de esos. Justo para ese codigotenes que poner graphing |
||
]; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ public function up() | |
$table->string('type'); | ||
$table->string('path')->nullable(); | ||
$table->string('link')->nullable(); | ||
$table->string('geotype')->nullable(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. esto no lo tenes que hacer aca a pelo, tenes que hacer una migracion nueva Una vez que completaste el up y down de esa migracion ejecutas las migraciones |
||
$table->timestamps(); | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ public function run() | |
factory(App\Resource::class, 1)->create(['name'=>'presentación', 'type'=>'presentación de diapositivas']); | ||
factory(App\Resource::class, 1)->create(['name'=>'hipervínculo', 'type'=>'hipervínculo']); | ||
factory(App\Resource::class, 1)->create(['name'=>'imagen', 'type'=>'imagen']); | ||
factory(App\Resource::class, 1)->create(['name'=>'ggb-element', 'type'=>'app geogebra']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name puede ser cualqueir cosa |
||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
@section('pagespecificscripts') | ||
<script src="{{ asset('js/resources.js') }}"></script> | ||
<script src="https://www.geogebra.org/apps/deployggb.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aca no lo necesitamos a esto. |
||
|
||
@stop | ||
|
||
@section('content') | ||
|
@@ -42,6 +44,17 @@ | |
</div> | ||
</div> | ||
|
||
<div class="form-group ggb-element"> | ||
<label for="geotype" class="col-md-2 control-label"><p>Seleccione tipo de elemento Geogebra</p></label> | ||
<div class="col-md-6"> | ||
<select class="form-control" name="geotype" id= "geotype"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aca el name y id van a ser geogebra_type |
||
@foreach ($geotypes as $geotype) | ||
<option value="{{$geotype}}">{{$geotype}}</option> | ||
@endforeach | ||
</select> | ||
</div> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tenes que agregar ademas un input para el otro campo que creaste geogebra_code. Es un input de tipo text |
||
|
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<button type="submit" class="btn btn-primary"> | ||
|
@@ -52,4 +65,5 @@ | |
</form> | ||
</div> | ||
</div> | ||
|
||
@endsection |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
@section('pagespecificscripts') | ||
<script src="{{ asset('js/resources.js') }}"></script> | ||
<script src="https://www.geogebra.org/apps/deployggb.js"></script> | ||
@stop | ||
|
||
@section('content') | ||
|
@@ -22,16 +23,26 @@ | |
<p>{!!$resource->type!!} </p> | ||
</div> | ||
|
||
@if(isset($resource->path)) | ||
<div class="container"> | ||
<h4>Archivo</h4> | ||
<a href="{{asset('/storage/'.$resource->path)}}" download="{{$resource->name}}">Bajar archivo actual</a> | ||
</div> | ||
@if ($resource->type == "Geogebra") | ||
<div id="ggb-element"></div> | ||
<script> | ||
var ggbApp = new GGBApplet({"appName": "{$resource->geotype}", "width": 800, "height": 600, "showToolBar": true, "showAlgebraInput": true, "showMenuBar": true, "material_id":"{$resource->name)}" }, true); | ||
window.addEventListener("load", function() { | ||
ggbApp.inject('ggb-element'); | ||
}); | ||
</script> | ||
Comment on lines
+28
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo esto lo tenes que pasar a la seccion de arriba donde estan los scripts. (linea 5) |
||
@else | ||
<div class="container"> | ||
<h4>Link</h4> | ||
<a href="{{asset($resource->link)}}" target="popup" onclick="window.open('', 'popup', 'width = 800, height = 600')">{{$resource->link}}</a> | ||
</div> | ||
@if(isset($resource->path)) | ||
<div class="container"> | ||
<h4>Archivo</h4> | ||
<a href="{{asset('/storage/'.$resource->path)}}" download="{{$resource->name}}">Bajar archivo actual</a> | ||
</div> | ||
@else | ||
<div class="container"> | ||
<h4>Link</h4> | ||
<a href="{{asset($resource->link)}}" target="popup" onclick="window.open('', 'popup', 'width = 800, height = 600')">{{$resource->link}}</a> | ||
</div> | ||
@endif | ||
@endif | ||
|
||
</form> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,13 @@ | |
</div> | ||
@endif | ||
|
||
<div class="form-group ggb-element"> | ||
<label for="ggb-element" class="col-md-2 control-label"><p>Geogebra</p></label> | ||
<div class="col-md-6"> | ||
<input id="ggb-element" type="text" class="form-control" value="{{$resource->geogebra_id}}" name="ggb-element" autofocus> | ||
</div> | ||
</div> | ||
|
||
Comment on lines
+58
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esto te tiene que quedar igual a lo que pusiste en el tempate de show, la diferencia es que tenes que agregar en el select, que se seleccione el geogebra_type que esta grabado en la base y en el geogebra_code, se complete el valor de la base tambien. |
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<button type="submit" class="btn btn-primary"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy bien esto!